CookieStoreManager:unsubscribe() 方法
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
备注: 此特性在 Service Worker 中可用。
CookieStoreManager
接口的 unsubscribe()
方法终止 ServiceWorkerRegistration
接收之前订阅的事件。
语法
js
unsubscribe(subscriptions)
参数
subscriptions
-
一个对象列表,每个对象包括以下属性:
返回值
异常
示例
在此示例中,被 registration
指示的 ServiceWorkerRegistration
取消订阅 "/path1"
作用域下命名为 "cookie1"
的 cookie 的变更事件。
js
const subscriptions = [{ name: "cookie1", url: `/path1` }];
await registration.cookies.unsubscribe(subscriptions);
规范
Specification |
---|
Cookie Store API # dom-cookiestoremanager-unsubscribe |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
unsubscribe |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.