ExtendableCookieChangeEvent:ExtendableCookieChangeEvent() 构造函数
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
备注: 此特性仅在 Service Worker 中可用。
ExtendableCookieChangeEvent() 构造函数会创建一个新的 ExtendableCookieChangeEvent 对象,该对象是传递给 cookiechange 事件的事件类型,当发生任何与 service worker 的 cookie 更改订阅列表匹配的 cookie 更改时,该事件会在 ServiceWorkerGlobalScope 中触发。当发生更改事件时,浏览器会调用此构造函数。
备注:网站通常不需要此事件构造函数。它主要用于需要此事件实例的测试。
语法
js
new ExtendableCookieChangeEvent(type)
new ExtendableCookieChangeEvent(type, options)
参数
type-
事件名称字符串。它区分大小写,并且浏览器始终将其设置为
cookiechange。 options可选-
配置对象,除了在
ExtendableEvent()中定义的属性之外,还可以具有以下属性:changed可选-
包含已更改的 cookie 的数组。
deleted可选-
包含已删除的 cookie 的数组。
返回值
一个新的 ExtendableCookieChangeEvent 对象。
规范
| Specification |
|---|
| Cookie Store API> # dom-extendablecookiechangeevent-extendablecookiechangeevent> |