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

Type Parameters

  • T = string

Properties

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

Methods

  • Read cookie

    Parameters

    • name: string

    Returns string | T

  • Read all available cookies

    Returns {
        [key: string]: string;
    }

    • [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>