Extends
Methods
-
<static> load()
-
Load data from localStorage.
- Source:
-
<static> save()
-
Save data to localStorage.
- Source:
-
addArray(key, defaultVal)
-
Add an array property.
Parameters:
Name Type Description keystring Key of this property
defaultValarray Default value of this property
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
addBool(key, defaultVal)
-
Add a boolean property.
Parameters:
Name Type Description keyString Key of this property
defaultValBoolean Default value of this property
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
addFloat(key, defaultVal)
-
Add a float number property.
Parameters:
Name Type Description keystring Key of this property
defaultValnumber Default value of this property
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
addInt(key, defaultVal)
-
Add a integer number property.
Parameters:
Name Type Description keystring Key of this property
defaultValnumber Default value of this property
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
addListener()
-
- Inherited From:
- Source:
-
addString(key, defaultVal)
-
Add a string property.
Parameters:
Name Type Description keystring Key of this property
defaultValstring Default value of this property
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
emit(event, a1, a2, a3, a4, a5)
-
Emit an event to all registered event listeners.
Parameters:
Name Type Description eventstring The name of the event.
a1* First param
a2* Second param
a3* Third param
a4* Forth param
a5* Fifth param
- Inherited From:
- Source:
Returns:
Indication if we've emitted an event.
- Type
- boolean
-
get(key)
-
Get value of a property
Parameters:
Name Type Description keystring Key of the property
- Inherited From:
- Source:
Returns:
Value of the property
- Type
- *
-
getArrayItem(key, idx)
-
Get value of an element of an array property
Parameters:
Name Type Description keystring Key of the array
idxnumber Index of the element
- Inherited From:
- Source:
Returns:
Value of the element or
undefined- Type
- *
-
has(key)
-
Check whether this data has a property with a key.
Parameters:
Name Type Description keystring Key to find
- Inherited From:
- Source:
Returns:
Whether a property with this key exist
- Type
- boolean
-
listeners(event, exists)
-
Return a list of assigned event listeners.
Parameters:
Name Type Description eventstring The events that should be listed.
existsboolean We only need to know if there are listeners.
- Inherited From:
- Source:
Returns:
Listener list
- Type
- array | boolean
-
off()
-
- Inherited From:
- Source:
-
on(event, fn, context)
-
Register a new EventListener for the given event.
Parameters:
Name Type Description eventstring Name of the event.
fnfuncton Callback function.
contextMixed The context of the function.
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- EventEmitter
-
once(event, fn, context)
-
Add an EventListener that's only called once.
Parameters:
Name Type Description eventstring Name of the event.
fnfunction Callback function.
contextMixed The context of the function.
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- EventEmitter
-
removeAllListeners(event)
-
Remove all listeners or only the listeners for the specified event.
Parameters:
Name Type Description eventstring The event want to remove all listeners for.
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- EventEmitter
-
removeListener(event, fn, context, once)
-
Remove event listeners.
Parameters:
Name Type Description eventstring The event we want to remove.
fnfunction The listener that we need to find.
contextMixed Only remove listeners matching this context.
onceboolean Only remove once listeners.
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- EventEmitter
-
set(key, value)
-
Set a property by key.
Parameters:
Name Type Description keystring Key of the property
value* Value to set
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
setArrayItem(key, idx, value)
-
Set value of an element of array property
Parameters:
Name Type Description keystring Key of the array
idxnumber Index of the element
valuebool Value to set
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
setBool(key, value)
-
Set a boolean property
Parameters:
Name Type Description keystring Key of this property
valueboolean Value to set
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
setFloat(key, value)
-
Set a float number property
Parameters:
Name Type Description keystring Key of the property
valuenumber Value to set
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
setInt(key, value)
-
Set a integer number property
Parameters:
Name Type Description keystring Key of the property
valuenumber Value to set
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
setString(key, value)
-
Set a string property
Parameters:
Name Type Description keystring Key of the property
valuestring Value to set
- Inherited From:
- Source:
Returns:
Self for chaining
- Type
- Data
-
validKey(key)
-
Check whether a key is valid.
Parameters:
Name Type Description keyString Key to validate
- Inherited From:
- Source:
Returns:
Whether this key is valid
- Type
- Boolean