web api event
CookieStore: change event
Secure context
A change event is fired at a CookieStore object when a change is made to any cookie.
Syntax
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("change", (event) => { })
onchange = (event) => { }
Event type
A CookieChangeEvent. Inherits from Event.
Examples
To be informed when a cookie has changed, you can add a handler to the cookieStore instance using addEventListener(), like this:
cookieStore.addEventListener("change", (event) => {
console.log("1 change event");
});
Alternatively, you can use the onchange event handler property to establish a handler for the change event:
cookieStore.onchange = (event) => {
console.log("1 change event");
};
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.