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 namestring State type name.
lastStateIdstring Last state identifier.
modulestring <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 keystring 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 keystring 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 namestring State type name.
componentObject 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 keystring 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 componentObject Component to register default states for.
-
<static> remove(key)
-
Deletes last state from local storage.
Parameters:
Name Type Description keystring The state to remove from local storage.
-
<static> set(key, value)
-
Saves the last state in local storage.
Parameters:
Name Type Description keystring The local storage key.
valuestring The value to associate with
key.