MCPcopy Index your code
hub / github.com/GoogleChrome/workbox / syncComplete

Method syncComplete

packages/workbox-background-sync/src/Queue.ts:429–459  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

427 }
428
429 const syncComplete = async () => {
430 this._syncInProgress = true;
431
432 let syncError;
433 try {
434 await this._onSync({queue: this});
435 } catch (error) {
436 if (error instanceof Error) {
437 syncError = error;
438
439 // Rethrow the error. Note: the logic in the finally clause
440 // will run before this gets rethrown.
441 throw syncError;
442 }
443 } finally {
444 // New items may have been added to the queue during the sync,
445 // so we need to register for a new sync if that's happened...
446 // Unless there was an error during the sync, in which
447 // case the browser will automatically retry later, as long
448 // as `event.lastChance` is not true.
449 if (
450 this._requestsAddedDuringSync &&
451 !(syncError && !event.lastChance)
452 ) {
453 await this.registerSync();
454 }
455
456 this._syncInProgress = false;
457 this._requestsAddedDuringSync = false;
458 }
459 };
460 event.waitUntil(syncComplete());
461 }
462 });

Callers

nothing calls this directly

Calls 1

registerSyncMethod · 0.95

Tested by

no test coverage detected