A change
event is fired at a CookieStore
object when a change is made to any cookie.
Use the event name in methods like addEventListener()
, or set an event handler property.
cookieStore.addEventListener("change", (event) => { })
cookieStore.onchange = (event) => { }
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 CookieStore.onchange
event handler property to establish a handler for the change
event:
cookieStore.onchange = (event) => {
console.log("1 change event");
};