CookieStoreManager - Web APIs | MDN
Instance methods
-
Returns a
Promisewhich resolves to a list of the cookie change subscriptions for this service worker registration. -
Subscribes to changes to cookies. It returns a
Promisewhich resolves when the subscription is successful. -
Unsubscribes the registered service worker from changes to cookies. It returns a
Promisewhich resolves when the operation is successful.
Examples
In this example, the ServiceWorkerRegistration represented by registration is subscribing to change events on the cookie named "cookie1" with a scope of "/path1".
js
const subscriptions = [{ name: "cookie1", url: `/path1` }];
await registration.cookies.subscribe(subscriptions);
If the ServiceWorkerRegistration has subscribed to any cookies, then getSubscriptions() will return a list of cookies represented by objects in the same format as used for the original subscription.
js
const subscriptions = await self.registration.cookies.getSubscriptions();
Specifications
| Specification |
|---|
| Cookie Store API # cookiestoremanager |