Documentation - v6.7.1
    Preparing search index...

    Interface CookieStore

    Async, event-driven API for reading and writing cookies.

    interface CookieStore {
        addEventListener<K extends "change">(
            type: K,
            listener: (ev: CookieStoreEventMap[K]) => any,
            options?: boolean | AddEventListenerOptions,
        ): void;
        addEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | AddEventListenerOptions,
        ): void;
        delete(
            options: {
                domain?: string;
                name: string;
                partitioned?: boolean;
                path?: string;
            },
        ): Promise<void>;
        dispatchEvent(event: Event): boolean;
        dispatchEvent(event: Event): boolean;
        get(name: string): Promise<CookieStoreItem | null>;
        getAll(name?: string): Promise<CookieStoreItem[]>;
        removeEventListener<K extends "change">(
            type: K,
            listener: (ev: CookieStoreEventMap[K]) => any,
            options?: boolean | EventListenerOptions,
        ): void;
        removeEventListener(
            type: string,
            listener: EventListenerOrEventListenerObject,
            options?: boolean | EventListenerOptions,
        ): void;
        set(
            options: {
                domain?: string;
                expires?: number | Date;
                name: string;
                partitioned?: boolean;
                path?: string;
                sameSite?: "none" | "strict" | "lax";
                secure?: boolean;
                value: string;
            },
        ): Promise<void>;
    }

    Hierarchy (View Summary)

    Index
    • Adds a typed listener for the given cookie store event.

      Type Parameters

      • K extends "change"

      Parameters

      • type: K
      • listener: (ev: CookieStoreEventMap[K]) => any
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Parameters

      • type: string
      • listener: EventListenerOrEventListenerObject
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Deletes a cookie matching the given attributes.

      Parameters

      • options: { domain?: string; name: string; partitioned?: boolean; path?: string }

      Returns Promise<void>

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • Removes a typed listener for the given cookie store event.

      Type Parameters

      • K extends "change"

      Parameters

      • type: K
      • listener: (ev: CookieStoreEventMap[K]) => any
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Parameters

      • type: string
      • listener: EventListenerOrEventListenerObject
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Sets a cookie with the given attributes.

      Parameters

      • options: {
            domain?: string;
            expires?: number | Date;
            name: string;
            partitioned?: boolean;
            path?: string;
            sameSite?: "none" | "strict" | "lax";
            secure?: boolean;
            value: string;
        }

      Returns Promise<void>