files/en-us/web/api/extendablecookiechangeevent/changed/index.md
{{securecontext_header}}{{APIRef("Cookie Store API")}}{{AvailableInWorkers("service")}}
The changed read-only property of the {{domxref("ExtendableCookieChangeEvent")}} interface returns any cookies that have been changed by the given ExtendableCookieChangeEvent instance.
An array of objects containing the changed cookie(s). Each object contains the following properties:
name
value
domain
path
expires
secure
sameSite
SameSite values:
"strict"
"lax"
"none"
partitioned
true) or not (false). See Cookies Having Independent Partitioned State (CHIPS) for more information.In this example when the cookie is set, the event listener logs the changed property to the console. The first item in that array contains an object representing the cookie that has just been set.
self.addEventListener("cookiechange", (event) => {
console.log(event.changed[0]);
});
const oneDay = 24 * 60 * 60 * 1000;
cookieStore.set({
name: "cookie1",
value: "cookie1-value",
expires: Date.now() + oneDay,
domain: "example.com",
});
{{Specifications}}
{{Compat}}