API Documentation for: 0.11.8
Show:

platypus.StateMap Class

Defined in: platypus.StateMap:1
Module: platypus

Available since 0.8.0

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

Constructor

platypus.StateMap

() platypus.StateMap

Defined in platypus.StateMap:1

Available since 0.8.0

Returns:

platypus.StateMap:

stateMap Returns the new StateMap object.

Methods

clear

()

Inherited from platypus.DataMap: clear:134

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

DataMap.recycle

(
  • dataMap
)

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

Parameters:

DataMap.setUp

() platypus.DataMap

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

Returns:

platypus.DataMap:

dataMap The instantiated DataMap.

delete

(
  • key
)
Any

Inherited from platypus.DataMap: delete:125

Deletes a key (and value) from the DataMap.

Parameters:

  • key String

    The key to delete from the DataMap.

Returns:

Any:

value The value of the key is returned.

get

(
  • key
)
Any

Inherited from platypus.DataMap: get:97

Returns the value of the provided key.

Parameters:

  • key String

    The key to lookup.

Returns:

Any:

value The value of the provded key.

has

(
  • key
)
Boolean

Inherited from platypus.DataMap: has:106

Determines whether the provided key is available on this DataMap.

Parameters:

  • key String

    The key to lookup.

Returns:

Boolean:

value Whether the key is listed in this DataMap.

includes

(
  • state
)
Boolean

Defined in includes:96

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

Parameters:

Returns:

Boolean:

Whether this state matches the provided state.

intersects

(
  • state
)
Boolean

Defined in intersects:120

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

Parameters:

Returns:

Boolean:

Whether this state intersects the provided state.

recycle

()

Inherited from platypus.DataMap but overwritten in recycle:156

Relinquishes StateMap properties and recycles it.

set

(
  • key
  • value
)
Any

Inherited from platypus.DataMap: set:115

Sets a value to a key in the DataMap.

Parameters:

  • key String

    The key to associate with the provided value.

  • value Any

    The value to be stored by the DataMap.

Returns:

Any:

value The value passed in is returned for chaining.

StateMap.recycle

(
  • stateMap
)

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

Parameters:

StateMap.setUp

() platypus.StateMap

Defined in StateMap.setUp:144

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

Returns:

platypus.StateMap:

stateMap The instantiated StateMap.

toJSON

() Object

Inherited from platypus.DataMap: toJSON:141

Available since 0.11.0

Returns a JSON object describing the component.

Returns:

Object:

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

update

(
  • state
)
Boolean

Defined in update:68

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

Parameters:

Returns:

Boolean:

Whether this state already matches the provided state.

updateFromString

(
  • states
)
chainable

Defined in updateFromString:32

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
                                             }

Parameters:

  • states String

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

Properties

keys

Array

Inherited from platypus.DataMap: keys:88

Tracks keys on this object to make iteration faster.

Default: []