Namespace

stat_data

stat_data

Data Access Layer: cookie, session & local storage manager

Methods

static get(key) → {string}

Get storage value (search in local, then in session).

Parameters:
Name Type Description
key string

Key of Value

The data value corresponding to key, empty string if not found

string

static getCookie(cookieName) → {string}

Retrieve a cookie value.

Parameters:
Name Type Description
cookieName string

Name of stored cookie

The cookie value, empty string if not found

string

static getSession(key) → {string}

Get a session value.

Parameters:
Name Type Description
key string

Key of Value

The data value corresponding to key, empty string if not found

string

static now() → {number}

Now() emulation

Number of milliseconds since Jan.1st,1970

number

static remove(key)

Remove a value from localStorage.

Parameters:
Name Type Description
key string

Key of Value

static removeCookie(cookieName, domainopt)

Remove a cookie

Parameters:
Name Type Attributes Description
cookieName string

Name of cookie to be removed

domain string <optional>

Domain or sub domain of the cookie

static set(key, value, exDaysopt)

Set a storage value, with expiration.

Parameters:
Name Type Attributes Description
key string

Key of Value

value string

Value to be stored

exDays number <optional>

Expiration (number of days): if not provided or empty, store in session.

static setCookie(cookieName, value, domainopt, exDays)

Set a cookie value.

Parameters:
Name Type Attributes Description
cookieName string

Name of cookie to be stored

value string

Value of cookie to be stored

domain string <optional>

Domain or sub domain of the cookie

exDays number

Expiration (number of days)

static setSession(key, value)

Set a session value.

Parameters:
Name Type Description
key string

Key of Value

value string

Value to be stored