CookieStore: change event
Cookie Store API
Cookie Store API
A change event is fired at a CookieStore object when a change is made to any cookie.
Syntax
Use the event name in addEventListener():
addEventListener("change", (event) => { })
Alternatively, assign to the event handler property of the interface:
onchange = (event) => { }
Event type
A CookieChangeEvent. Inherits from Event.
CookieChangeEvent
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 (but note that this replaces other event listeners added using onchange, if any):
cookieStore.onchange = (event) => {
console.log("1 change event");
};