Back to Content

PeriodicSyncManager: unregister() method

files/en-us/web/api/periodicsyncmanager/unregister/index.md

latest1.0 KB
Original Source

{{APIRef("Periodic Background Sync")}}{{SeeCompatTable}}{{AvailableInWorkers}}

The unregister() method of the {{domxref("PeriodicSyncManager")}} interface unregisters the periodic sync request corresponding to the specified tag and returns a {{jsxref('Promise')}} that resolves when unregistration completes.

Syntax

js-nolint
unregister(tag)

Parameters

  • tag
    • : The unique {{jsxref('String')}} descriptor for the specific background sync.

Return value

Returns a {{jsxref("Promise")}} that resolves with {{jsxref('undefined')}}.

Exceptions

None.

Examples

The following example removes a periodic sync to stop syncing articles in the background.

js
navigator.serviceWorker.ready.then((registration) => {
  registration.periodicSync.unregister("get-latest-news");
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also