Skip to content Skip to sidebar Skip to footer

Service Worker - Is There Anyway To Know Service Worker Has Finished All Background - Sync Tags?

Service Worker - Is there anyway to know service worker has finished all background - sync? I have written a set of different sync tasks for service worker, but am wondering is the

Solution 1:

The getTags() method of the SyncManager interface should give you the info you're looking for.

self.addEventListener('sync', async (event) => {
  // Handle event...

  // Afterwards...
  const tags = await self.registration.sync.getTags();
  if (tags.length === 0) {
    // There are no registered tags.
  }
});

Post a Comment for "Service Worker - Is There Anyway To Know Service Worker Has Finished All Background - Sync Tags?"