Friday, 18 September 2020

How to enable sync manager in electron?

I am building an offline cross-platform using electron. It uses a service worker to make the app offline first. When I try to register the sync manager through following command:-

swRegistration.sync.register('myFirstSync')

Expected behavior

On the page with a service worker registered, this snippet should produce no errors.

navigator.serviceWorker.ready.then(function(swRegistration) {
  return swRegistration.sync.register('myFirstSync');
});

Actual behavior

When running with an electron, I get

Uncaught (in promise) DOMException: Background Sync is disabled.

I need to enable sync manager. Any idea of how it can be done?



from How to enable sync manager in electron?

No comments:

Post a Comment