Manual Reference Source Test
import IdentityCookie from 'src/modules/identity-cookie.js'
public class | source

IdentityCookie

Identity SDK cookie helpers

Constructor Summary

Public Constructor
public

constructor(config: Object)

Set a list of available cookie names

Method Summary

Public Methods
public

getCookie(name: string, options: Object): string

Get from document cookies

public

Get enabled flag

public

Remove from cookies

public

setCookie(name: string, value: string, options: Object, expires: number)

Set a wildcard domain cookie with an expiry of 1 year (12 months)

public

setEnabled(isEnabled: boolean)

Set enabled flag

public

subscribe(name: string, callback: function, period: number): number

Subscribe to cookie changes

public

Unsubscribe from cookie changes

Public Constructors

public constructor(config: Object) source

Set a list of available cookie names

Params:

NameTypeAttributeDescription
config Object

Public Methods

public getCookie(name: string, options: Object): string source

Get from document cookies

Params:

NameTypeAttributeDescription
name string

cookie name

options Object

additional options on setting cookie

Return:

string

or null

public isEnabled(): boolean source

Get enabled flag

Return:

boolean

public removeCookie(name: string) source

Remove from cookies

Params:

NameTypeAttributeDescription
name string

public setCookie(name: string, value: string, options: Object, expires: number) source

Set a wildcard domain cookie with an expiry of 1 year (12 months)

Params:

NameTypeAttributeDescription
name string

cookie name

value string

cookie value

options Object

additional options on setting cookie

expires number

days until expiry

public setEnabled(isEnabled: boolean) source

Set enabled flag

Params:

NameTypeAttributeDescription
isEnabled boolean

public subscribe(name: string, callback: function, period: number): number source

Subscribe to cookie changes

Params:

NameTypeAttributeDescription
name string
callback function
period number

Return:

number

Interval id

public unsubscribe(id: number) source

Unsubscribe from cookie changes

Params:

NameTypeAttributeDescription
id number