interface ICookieMgr {
    del(name: string, path?: string): boolean;
    get(name: string): string;
    isEnabled(): boolean;
    purge(name: string, path?: string): boolean;
    set(name: string, value: string, maxAgeSec?: number, domain?: string, path?: string): boolean;
    setEnabled(value: boolean): void;
    unload?(isAsync?: boolean): void | IPromise<void>;
    update?(updateState: ITelemetryUpdateState): void;
}

Methods

  • Delete/Remove the named cookie if cookie support is available and enabled. Note: Not using "delete" as the name because it's a reserved word which would cause issues on older browsers

    Parameters

    • name: string

      The name of the cookie

    • Optionalpath: string

      [optional] Path to set for the cookie, if not supplied will default to "/"

    Returns boolean

    • True if the cookie was marked for deletion otherwise false (Because cookie usage is not enabled or available)
  • Purge the cookie from the system if cookie support is available, this function ignores the enabled setting of the manager so any cookie will be removed. Note: Not using "delete" as the name because it's a reserved word which would cause issues on older browsers

    Parameters

    • name: string

      The name of the cookie

    • Optionalpath: string

      [optional] Path to set for the cookie, if not supplied will default to "/"

    Returns boolean

    • True if the cookie was marked for deletion otherwise false (Because cookie usage is not available)
  • Set the named cookie with the value and optional domain and optional

    Parameters

    • name: string

      The name of the cookie

    • value: string

      The value of the cookie (Must already be encoded)

    • OptionalmaxAgeSec: number

      [optional] The maximum number of SECONDS that this cookie should survive

    • Optionaldomain: string

      [optional] The domain to set for the cookie

    • Optionalpath: string

      [optional] Path to set for the cookie, if not supplied will default to "/"

    Returns boolean

    • True if the cookie was set otherwise false (Because cookie usage is not enabled or available)
  • Unload and remove any state that this ICookieMgr may be holding, this is generally called when the owning SDK is being unloaded.

    Parameters

    • OptionalisAsync: boolean

      Can the unload be performed asynchronously (default)

    Returns void | IPromise<void>

    If the unload occurs synchronously then nothing should be returned, if happening asynchronously then the function should return an IPromise / Promise to allow any listeners to wait for the operation to complete.

  • Optional Callback hook to allow the cookie manager to update it's configuration, not generally implemented now that dynamic configuration is supported

    Parameters

    Returns void