ImmutableStore
Constructor Summary
| Public Constructor | ||
| public |
constructor(initialData: *) |
|
Member Summary
| Public Members | ||
| public |
Returns a list of items that match a filter. |
|
| public |
getIndexById: * |
|
| public |
getItemById: * |
|
| public |
initialData: * |
|
| public |
|
|
| public |
reset: * |
|
| public |
state: * |
|
Method Summary
| Public Methods | ||
| public |
change(prop: *, value: *) Changes a property to a new value. |
|
| public |
changeItem(filter: object, data: object) Changes a specific item in a list within the state object. |
|
| public |
init(data: *): * |
|
| public |
setItemProp(id: *, key: *, value: *, listName: *): * |
|
| public |
useApi(): * |
|
Public Constructors
public constructor(initialData: *) source
Params:
| Name | Type | Attribute | Description |
| initialData | * |
Public Members
public find(listName: string, filter: object): List: * source
Returns a list of items that match a filter.
Return:
| List | A new immutable list that only contains items that matched all key/value pairs of |
public getIndexById: * source
public getItemById: * source
public initialData: * source
public reset: * source
public state: * source
Public Methods
public change(prop: *, value: *) source
Changes a property to a new value. There are three modes of calling this function:
change('key', value) changes one property of the state object.
Params:
| Name | Type | Attribute | Description |
| prop | * | ||
| value | * |
See:
- https://facebook.github.io/immutable-js/docs/#/Map/set __change({key: value, ...})__ changes any number of state properties at once
- https://facebook.github.io/immutable-js/docs/#/Map/mergeDeep __change({id:5}, {key: value})__ changes any number of properties on any matching item within a list
- {@link #changeItem()}
- https://facebook.github.io/immutable-js/docs/#/Map/mergeDeep
public changeItem(filter: object, data: object) source
Changes a specific item in a list within the state object.
Params:
| Name | Type | Attribute | Description |
| filter | object | ||
| filter.item | object | An object that specifies key/value pairs that must be matched by list items, e.g. {id: 13} |
|
| filter.list | string |
|
The name of the list to search in. Defaults to 'items' |
| data | object | An object containing key/value pairs for data to be set at matched items |
Throw:
* |
Error if when no item could be found |
public setItemProp(id: *, key: *, value: *, listName: *): * source
Params:
| Name | Type | Attribute | Description |
| id | * | ||
| key | * | ||
| value | * | ||
| listName | * |
Return:
| * |