Class: List

List

List collection to store an ordered list of values

Methods


get(index)

Retrieve item by index
Parameters:
Name Type Description
index Number item index
Returns:
Type
Promise.<Item>

getItems(args)

Query items from List
Parameters:
Name Type Description
args Object Arguments for items query
Properties
Name Type Description
from String Item, which should be used as an anchor. If undefined, starts from the beginning or end depending on args.order
pageSize Number Results page size
order String Order of results, should be 'asc' or 'desc'
Returns:
Type
Promise.<Paginator>

mutate(Index, Mutator)

Updates the existing item value
Parameters:
Name Type Description
Index Number Item key
Mutator List~Mutator Function performing value mutation
Returns:
Type
Promise

push(value)

Add element to the List
Parameters:
Name Type Description
value Object value to add
Returns:
A new item
Type
Promise.<Item>

remove()

Remove List item by index
Returns:
Promise to remove, which may fail

removeList()

Remove list from service. It will be impossible to restore it.
Returns:
Promise to delete the collection
Type
Promise

set(index, value [, conditional])

Update existing item in a List
Parameters:
Name Type Argument Default Description
index Number index in the List
value Object value to set
conditional Boolean <optional>
false Check for remote modification when updating. If true, promise will be rejected if value was remotely modified
Returns:
- A new element
Type
Promise.<Item>

update(Index, update)

Parameters:
Name Type Description
Index Number Item key
update Object Set of fields to update
Returns:
Result data
Type
Promise.<Item>

Type Definitions


Mutator(data)

Applies a transformation to the item value
Parameters:
Name Type Description
data Object current value of an item
Returns:
Modified data for an item
Type
Object

Events


collectionRemoved

Fired when List is removed from server

itemAdded

Fired when item is added to List
Type: Item

itemRemoved

Fired when item is added to List
Type: String

itemUpdated

Fired when item is added to List
Type: Item