CookieChangeEvent:CookieChangeEvent() 构造函数
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
CookieChangeEvent()
构造函数创建一个新的 CookieChangeEvent
对象,这是发生任何 cookie 更改时在 CookieStore
上触发的 change
事件的事件类型。当变更事件发生时浏览器调用这个构造函数。
备注: 此事件构造函数通常不在生产环境的站点上使用。它主要用于测试需要此事件的实例。
语法
js
new CookieChangeEvent(type)
new CookieChangeEvent(type, options)
参数
type
-
包含事件名称的字符串。它区分大小写,且浏览器总是将其设置为
change
。 options
可选-
一个对象,该对象除了在
Event()
中定义的属性之外,还可以具有以下属性:changed
可选-
一个包含已被修改的 cookie 的数组。
deleted
可选-
一个包含已被删除的 cookie 的数组。
返回值
一个新的 CookieChangeEvent
对象。
规范
Specification |
---|
Cookie Store API # dom-cookiechangeevent-cookiechangeevent |
浏览器兼容性
BCD tables only load in the browser