Interface CookieStore
onchange: ((this: CookieStore, ev: CookieChangeEvent) => any) | null;
addEventListener<K extends "change">(
type: K,
listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
delete(name: string): Promise<void>;
delete(options: CookieStoreDeleteOptions): Promise<void>;
dispatchEvent(event: Event): boolean;
get(name: string): Promise<CookieListItem | null>;
get(options?: CookieStoreGetOptions): Promise<CookieListItem | null>;
getAll(name: string): Promise<CookieList>;
getAll(options?: CookieStoreGetOptions): Promise<CookieList>;
removeEventListener<K extends "change">(
type: K,
listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
set(name: string, value: string): Promise<void>;
set(options: CookieInit): Promise<void>;
}
Hierarchy
- EventTarget
- CookieStore
Index
Properties
Methods
Methods
addEventListener
- addEventListener<K extends "change">(
type: K,
listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends "change"
Parameters
- type: K
- listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
delete
The
delete()method of the CookieStore interface deletes a cookie that matches the givennameoroptionsobject.Parameters
- name: string
Returns Promise<void>
Parameters
- options: CookieStoreDeleteOptions
Returns Promise<void>
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
get
The
get()method of the CookieStore interface returns a Promise that resolves to a single cookie matching the givennameoroptionsobject.Parameters
- name: string
Returns Promise<CookieListItem | null>
Parameters
Optionaloptions: CookieStoreGetOptions
Returns Promise<CookieListItem | null>
getAll
The
getAll()method of the CookieStore interface returns a Promise that resolves as an array of cookies that match thenameoroptionspassed to it.Parameters
- name: string
Returns Promise<CookieList>
Parameters
Optionaloptions: CookieStoreGetOptions
Returns Promise<CookieList>
removeEventListener
- removeEventListener<K extends "change">(
type: K,
listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends "change"
Parameters
- type: K
- listener: (this: CookieStore, ev: CookieStoreEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
set
The
set()method of the CookieStore interface sets a cookie with the givennameandvalueoroptionsobject.Parameters
- name: string
- value: string
Returns Promise<void>
Parameters
- options: CookieInit
Returns Promise<void>
The
CookieStoreinterface of the Cookie Store API provides methods for getting and setting cookies asynchronously from either a page or a service worker. Available only in secure contexts.MDN Reference