Building Progressive Web Apps: Bringing the Power of Native to the Browser by Ater Tal

Building Progressive Web Apps: Bringing the Power of Native to the Browser by Ater Tal

Author:Ater, Tal [Ater, Tal]
Language: eng
Format: azw3, epub
Publisher: O'Reilly Media
Published: 2017-08-08T04:00:00+00:00


Registering Events

To register a sync event, you can call register on the SyncManager, passing it the name (also known as the tag) of the sync event you would like to register.

For example, to register a "send-messages" event from the service worker, you can use the following code:

self.registration.sync.register("send-messages");

To register the same event from a page controlled by a service worker, use the following code:

navigator.serviceWorker.ready.then(function(registration) { registration.sync.register("send-messages"); });



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.