-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
46 lines (30 loc) · 1.2 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "CookieStoreManager: getSubscriptions() method"
short-title: getSubscriptions()
slug: Web/API/CookieStoreManager/getSubscriptions
page-type: web-api-instance-method
browser-compat: api.CookieStoreManager.getSubscriptions
---
{{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}}