MCPcopy
hub / github.com/GoogleChrome/workbox / registerSync

Method registerSync

packages/workbox-background-sync/src/Queue.ts:393–409  ·  view source on GitHub ↗

* Registers a sync event with a tag unique to this instance.

()

Source from the content-addressed store, hash-verified

391 * Registers a sync event with a tag unique to this instance.
392 */
393 async registerSync(): Promise<void> {
394 // See https://github.com/GoogleChrome/workbox/issues/2393
395 if ('sync' in self.registration && !this._forceSyncFallback) {
396 try {
397 await self.registration.sync.register(`${TAG_PREFIX}:${this._name}`);
398 } catch (err) {
399 // This means the registration failed for some reason, possibly due to
400 // the user disabling it.
401 if (process.env.NODE_ENV !== 'production') {
402 logger.warn(
403 `Unable to register sync event for '${this._name}'.`,
404 err,
405 );
406 }
407 }
408 }
409 }
410
411 /**
412 * In sync-supporting browsers, this adds a listener for the sync event.

Callers 3

_addRequestMethod · 0.95
syncCompleteMethod · 0.95
test-Queue.mjsFile · 0.80

Calls 1

registerMethod · 0.65

Tested by

no test coverage detected