CookieStoreManager: phương thức getSubscriptions()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Service Workers.
Phương thức getSubscriptions() của giao diện CookieStoreManager trả về danh sách tất cả các đăng ký thay đổi cookie cho ServiceWorkerRegistration này.
Cú pháp
js
getSubscriptions()
Tham số
Không có.
Giá trị trả về
Một Promise được phân giải với một danh sách đối tượng, mỗi đối tượng chứa:
Ví dụ
Nếu ServiceWorkerRegistration được biểu diễn bởi registration đã đăng ký với bất kỳ sự kiện thay đổi cookie nào, subscriptions sẽ được phân giải thành một danh sách đối tượng chứa tên và URL của các cookie đó.
js
const subscriptions = await self.registration.cookies.getSubscriptions();
Thông số kỹ thuật
| Specification |
|---|
| Cookie Store API> # dom-cookiestoremanager-getsubscriptions> |