Class: LastState

LastState


new LastState()

Allows interactions with the last state values, which are used to implement last application states or "stickiness".

Methods


<static> buildKey(name, lastStateId [, module])

Builds the key for a given name, lastStateId, and (optionally) module, which is used as a key for CRUD operations on last state values.

Parameters:
Name Type Argument Description
name string

State type name.

lastStateId string

Last state identifier.

module string <optional>

Module name.

Returns:

A last state key corresponding to the given values.

Type
string

<static> defaults(key)

Gets the default last state for a key.

Parameters:
Name Type Description
key string

A last state key.

Returns:

The default last state for the given key.

Type
string

<static> get(key)

Get the last state value given a key. If it doesn't exist, return the default value as specified in the component metadata.

Parameters:
Name Type Description
key string

The local storage key.

Returns:

The last state value.

Type
*

<static> key(name, component)

Gets the key for a given component, which is used as a key for CRUD operations on last state values.

Parameters:
Name Type Description
name string

State type name.

component Object

Component name.

Returns:

A last state key corresponding to the given values.

Type
string

<static> preserve(key)

Registers a state as important (should survive a cache clean).

Parameters:
Name Type Description
key string

The key of the state to preserve.


<static> register(component)

Registers last states default values given a component. The default value is specified in the component metadata.

Parameters:
Name Type Description
component Object

Component to register default states for.


<static> remove(key)

Deletes last state from local storage.

Parameters:
Name Type Description
key string

The state to remove from local storage.


<static> set(key, value)

Saves the last state in local storage.

Parameters:
Name Type Description
key string

The local storage key.

value string

The value to associate with key.