BackgroundFetchManager: getIds() method

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("Background Fetch API")}}{{SeeCompatTable}}{{AvailableInWorkers}}

The **getIds()** method of the {{domxref("BackgroundFetchManager")}} interface returns the IDs of all registered background fetches.

Syntax

js-nolint
getIds()

Parameters

None.

Return value

A {{jsxref("Promise")}} that resolves with an {{jsxref('Array')}} of {{jsxref('String', 'strings')}}.

Exceptions

None.

Examples

The following example shows how to retrieve the IDs of all registered background fetches. With an active service worker, use the {{domxref('ServiceWorkerRegistration.backgroundFetch')}} property to access the BackgroundFetchManager object and call its getIds() method.

js
navigator.serviceWorker.ready.then(async (swReg) => {
  const ids = await swReg.backgroundFetch.getIds();
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}