devowl-wp
    Preparing search index...
    interface CookiesStatic<T = string> {
        attributes: CookieAttributes;
        converter: Required<Converter<string>>;
        get(name: string): string | T;
        get(): { [key: string]: string };
        remove(name: string, options?: CookieAttributes): void;
        set(name: string, value: string | T, options?: CookieAttributes): string;
        withAttributes(attributes: CookieAttributes): CookiesStatic<T>;
        withConverter<TConv = string>(
            converter: Converter<TConv>,
        ): CookiesStatic<TConv>;
    }

    Type Parameters

    • T = string
    Index

    Properties

    attributes: CookieAttributes
    converter: Required<Converter<string>>

    Methods

    • Read cookie

      Parameters

      • name: string

      Returns string | T

    • Read all available cookies

      Returns { [key: string]: string }

    • Delete cookie

      Parameters

      Returns void

    • Create a cookie

      Parameters

      Returns string

    • Cookie attribute defaults can be set globally by creating an instance of the api via withAttributes(), or individually for each call to Cookies.set(...) by passing a plain object as the last argument. Per-call attributes override the default attributes.

      Parameters

      Returns CookiesStatic<T>

    • Create a new instance of the api that overrides the default decoding implementation. All methods that rely in a proper decoding to work, such as Cookies.remove() and Cookies.get(), will run the converter first for each cookie. The returned string will be used as the cookie value.

      Type Parameters

      • TConv = string

      Parameters

      Returns CookiesStatic<TConv>