CookieStoreManager: getSubscriptions() method
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{securecontext_header}}{{APIRef("Cookie Store API")}}{{AvailableInWorkers("window_and_service")}}
The **getSubscriptions()** method of the {{domxref("CookieStoreManager")}} interface returns a list of all the cookie change subscriptions for this {{domxref("ServiceWorkerRegistration")}}.
Syntax
js-nolint
getSubscriptions()Parameters
None.
Return value
A {{jsxref("Promise")}} that resolves with a list of objects, each containing:
name- : A string with the name of a cookie.
url- : A string with the url of the scope used to subscribe to the cookie(s).
Examples
If the {{domxref("ServiceWorkerRegistration")}} represented by registration has subscribed to any cookie change events, subscriptions will resolve to a list of objects containing the name and URL of those cookies.
js
const subscriptions = await self.registration.cookies.getSubscriptions();Specifications
{{Specifications}}
Browser compatibility
{{Compat}}