StateMap

platypus. StateMap

new StateMap() → {platypus.StateMap}

This class defines a state object to use for entity states with helper methods. It includes recycle methods to encourage reuse.

Source:
Returns:
Type:
platypus.StateMap

stateMap Returns the new StateMap object.

Extends

Methods

(static) recycle(stateMap)

Returns StateMap back to the cache. Prefer the StateMap's recycle method since it recycles property objects as well.

Source:
Parameters:
Name Type Description
stateMap platypus.StateMap

The StateMap to be recycled.

(static) setUp() → {platypus.StateMap}

Returns StateMap from cache or creates a new one if none are available.

Source:
Returns:
Type:
platypus.StateMap

The instantiated StateMap.

clear()

Clears out of keys (and values) from the DataMap.

Inherited From:
Source:

delete(key) → {any}

Deletes a key (and value) from the DataMap.

Inherited From:
Source:
Parameters:
Name Type Description
key String

The key to delete from the DataMap.

Returns:
Type:
any

value The value of the key is returned.

get(key) → {any}

Returns the value of the provided key.

Inherited From:
Source:
Parameters:
Name Type Description
key String

The key to lookup.

Returns:
Type:
any

value The value of the provded key.

has(key) → {Boolean}

Determines whether the provided key is available on this DataMap.

Inherited From:
Source:
Parameters:
Name Type Description
key String

The key to lookup.

Returns:
Type:
Boolean

value Whether the key is listed in this DataMap.

includes(state) → {Boolean}

Checks whether the provided state matches all equivalent keys on this state.

Source:
Parameters:
Name Type Description
state platypus.StateMap

The state that this state should match.

Returns:
Type:
Boolean

Whether this state matches the provided state.

intersects(state) → {Boolean}

Checks whether the provided state matches any equivalent keys on this state.

Source:
Parameters:
Name Type Description
state platypus.StateMap

The state that this state should intersect.

Returns:
Type:
Boolean

Whether this state intersects the provided state.

recycle()

Relinquishes StateMap properties and recycles it.

Overrides:
Source:

set(key, value) → {any}

Sets a value to a key in the DataMap.

Inherited From:
Source:
Parameters:
Name Type Description
key String

The key to associate with the provided value.

value any

The value to be stored by the DataMap.

Returns:
Type:
any

value The value passed in is returned for chaining.

toJSON() → {Object}

Returns a JSON object describing the component.

Inherited From:
Source:
Returns:
Type:
Object

Returns a JSON definition that can be used to recreate the component.

update(state) → {Boolean}

Checks whether the provided state matches this state and updates this state to match.

Source:
Parameters:
Name Type Description
state platypus.StateMap

The state that this state should match.

Returns:
Type:
Boolean

Whether this state already matches the provided state.

updateFromString(states)

Sets the state using the provided string value which is a comma-delimited list such that "blue,red,!green" sets the following state values:

 {
     red: true,
     blue: true,
     green: false
 }
Source:
Parameters:
Name Type Description
states String

A comma-delimited list of true/false state values.