Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling background sync in electron #9802

Closed
anilshanbhag opened this issue Jun 19, 2017 · 5 comments
Closed

Enabling background sync in electron #9802

anilshanbhag opened this issue Jun 19, 2017 · 5 comments

Comments

@anilshanbhag
Copy link

Electron has background sync disabled. Background sync is used to trigger the service worker to sync changes. It helps to sync work which was done by user when he was offline. Would be good to enable it by default. It is enabled by default in chromium and chrome.

  • Electron version: 1.6.11
  • Operating system: Mac OS, Linux

Expected behavior

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

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

Actual behavior

When run with electron, I get

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

How to reproduce

Open youtube.com with electron

OR

git clone https://github.com/hokein/electron-sample-apps
cd electron-sample-apps
npm install -g electron
electron service-worker/mock-response

Open the console and type in the snippet:

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

It gives the error in electron. Use the same snippet in youtube on the browser, it runs fine.

@deepak1556
Copy link
Member

Merging this to #6697 . Thanks for the report!

@arawinters
Copy link

I see this was merged to #6697 and closed. I went and checked #6697 and it's still open(since 2016? o_O). Maybe I'm missing something, but has this made it's way in to the electron releases or not?

I'm obviously asking because I'm still running in to the message:
DOMException: Background Sync is disabled.

was on 1.8.4. updated to 2.0.2 still seeing it. It's kind of ruining my day.

@WesWedding
Copy link

It is unclear to me why this was merged with the other issue. The other issue is about Web Push, which is distinct from Background Sync.

Which still appears to be disabled going in to 2020 on the latest Electron versions.

@abdallahemad94
Copy link

any news the issue still exists in electron version: 13.1.8 cannot use background sync gets the same error message
RROR Error: Uncaught (in promise): UnknownError: Background Sync is disabled.

and still the merged issue #6697 is open with no workaround for this error

@shenzhuxi
Copy link

"Uncaught (in promise) DOMException: Unknown error." with the simplest code like https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/periodicSync

sync and periodicSync still can't be registered in electron 17.1.2 though Chrome/98.0.4758.109 should support now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants