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 optionsObject <optional>
{} Additional options Properties
Name Type Description silentboolean 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 keyString 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 keyString property key value* property value optionsObject <nullable>
additional options Returns:
- Type
- undefined
-
setData(data, options) → {undefined}
-
Sets the full data object
Parameters:
Name Type Argument Description dataObject data object to set optionsObject <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 dataString | 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 dataNumber | Object numeric index value or an object with a numeric index property optionsObject <nullable>
additional options Returns:
whether the index was changed (true: was changed, false: was not changed)- Type
- boolean