new Item(data)
Manages a data object and adds an event API for setting values
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
data |
Object |
<optional> |
{} | object containing arbitrary data |
Mixes In
Methods
-
clear(options) → {undefined}
-
Clears the data object (sets to empty object)
Parameters:
Name Type Argument Default Description options
Object <optional>
{} Additional options Properties
Name Type Description silent
boolean If true, do not emit event after clear Returns:
- Type
- undefined
-
destroy() → {undefined}
-
Destroys the {@Item}
Returns:
- Type
- undefined
-
get(key) → {*}
-
Gets a single property value by key
Parameters:
Name Type Description key
String property key Returns:
property value- Type
- *
-
getData() → {Object}
-
Gets the full data object
Returns:
- Type
- Object
-
set(key, value, options) → {undefined}
-
Sets a single property value by key
Parameters:
Name Type Argument Description key
String property key value
* property value options
Object <nullable>
additional options Returns:
- Type
- undefined
-
setData(data, options) → {undefined}
-
Sets the full data object
Parameters:
Name Type Argument Description data
Object data object to set options
Object <nullable>
additional options Returns:
- Type
- undefined
-
setId(data) → {undefined}
-
Sets the Item's unique ID. This is required for indexing the item in various data structures in decks.js.
Parameters:
Name Type Description data
String | Number | Object the id string value, id numeric value, or an object which contains an id key Returns:
- Type
- undefined
-
setIndex(data, options) → {boolean}
-
Sets the Item's index
Parameters:
Name Type Argument Description data
Number | Object numeric index value or an object with a numeric index property options
Object <nullable>
additional options Returns:
whether the index was changed (true: was changed, false: was not changed)- Type
- boolean