注册服务工作者后,所有API调用均失败

时间:2019-06-14 11:29:35

标签: javascript service-worker

在App.js中成功注册serviceWorker之后,我的所有API都失败了。

overViewPdfGenerator = async () => {
    if ('serviceWorker' in navigator) {
        // site using a more restrictive scope.
         window.addEventListener('load', function() {
        navigator.serviceWorker.register('/ServiceWorker.js', {scope: './'}).then(function(registration) {
          console.log('Service worker registration succeeded:', registration);
        }, function(error) {
          console.log('Service worker registration failed:', error);
        });
      })
      } else {
        console.log('Service workers are not supported.');
      }
}

0 个答案:

没有答案