• Version 7.1.4
  • Published
  • 45.4 kB
  • 2 dependencies
  • MIT license


npm i universal-cookie
yarn add universal-cookie
pnpm add universal-cookie


Universal cookies for JavaScript



class Cookies

class Cookies {}


    constructor(cookies?: string | object, defaultSetOptions?: CookieSetOptions);

      property update

      update: () => void;

        method addChangeListener

        addChangeListener: (callback: CookieChangeListener) => void;

          method get

          get: {
          (name: string, options?: CookieGetOptions): any;
          <T>(name: string, options?: CookieGetOptions): T;

            method getAll

            getAll: {
            (options?: CookieGetOptions): any;
            <T>(options?: CookieGetOptions): T;

              method remove

              remove: (name: string, options?: CookieSetOptions) => void;

                method removeChangeListener

                removeChangeListener: (callback: CookieChangeListener) => void;

                  method set

                  set: (name: string, value: Cookie, options?: CookieSetOptions) => void;


                    interface CookieChangeOptions

                    interface CookieChangeOptions {}

                      property name

                      name: string;

                        property options

                        options?: CookieSetOptions;

                          property value

                          value?: any;

                            interface CookieGetOptions

                            interface CookieGetOptions {}

                              property doNotParse

                              doNotParse?: boolean;

                                property doNotUpdate

                                doNotUpdate?: boolean;

                                  interface CookieSetOptions

                                  interface CookieSetOptions {}

                                    property domain

                                    domain?: string;

                                      property expires

                                      expires?: Date;

                                        property httpOnly

                                        httpOnly?: boolean;

                                          property maxAge

                                          maxAge?: number;

                                            property partitioned

                                            partitioned?: boolean;

                                              property path

                                              path?: string;

                                                property sameSite

                                                sameSite?: boolean | 'none' | 'lax' | 'strict';

                                                  property secure

                                                  secure?: boolean;

                                                    Type Aliases

                                                    type Cookie = any;

                                                      type CookieChangeListener

                                                      type CookieChangeListener = (options: CookieChangeOptions) => void;

                                                        Package Files (3)

                                                        Dependencies (2)

                                                        Dev Dependencies (4)

                                                        Peer Dependencies (0)

                                                        No peer dependencies.


                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/universal-cookie.

                                                        • Markdown
                                                        • HTML
                                                          <a href="https://www.jsdocs.io/package/universal-cookie"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>