-
get(index)
-
Retrieve an item by List key.
Parameters:
| Name |
Type |
Description |
index |
Number
|
Item index in a List |
Returns:
A promise with an item containing latest known value.
A promise will be rejected if an item was not found.
-
Type
-
Promise.<ListItem>
-
getItems(args)
-
Query a list of items from collection.
Parameters:
| Name |
Type |
Description |
args |
Object
|
Arguments for query
Properties
| Name |
Type |
Description |
from |
Number
|
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
|
Lexicographical order of results, should be 'asc' or 'desc' |
|
Returns:
-
Type
-
Promise.<Paginator.<ListItem>>
-
mutate(index, mutator)
-
Modify an existing item by applying a mutation function to it.
Parameters:
| Name |
Type |
Description |
index |
Number
|
Index of an item to be changed |
mutator |
List~Mutator
|
A function that outputs a new value based on the existing value |
Returns:
A promise with a modified item containing latest known value.
A promise will be rejected if an item was not found.
-
Type
-
Promise.<ListItem>
-
push(value)
-
Add a new item to the list.
Parameters:
| Name |
Type |
Description |
value |
Object
|
Value to be added |
Returns:
A newly added item.
-
Type
-
Promise.<ListItem>
-
remove(index)
-
Delete an item, given its key.
Parameters:
| Name |
Type |
Description |
index |
number
|
Index of an item to be removed |
Returns:
A promise to remove an item.
A promise will be rejected if an item was not found.
-
Type
-
Promise.<void>
-
removeList()
-
Delete this list. It will be impossible to restore it.
Returns:
A promise that resolves when the list has been deleted.
-
Type
-
Promise.<void>
-
set(index, value)
-
Assign new value to an existing item, given its index.
Parameters:
| Name |
Type |
Description |
index |
Number
|
Index of an item to be updated |
value |
Object
|
New value to be assigned to an item |
Returns:
A promise with updated item containing latest known value.
A promise will be rejected if value was remotely modified.
-
Type
-
Promise.<ListItem>
-
update(index, obj)
-
Modify an existing item by appending new fields (or overwriting existing ones) with the values from Object.
Parameters:
| Name |
Type |
Description |
index |
Number
|
Index of an item to be changed |
obj |
Object
|
Set of fields to update |
Returns:
A promise with a modified item containing latest known value.
A promise will be rejected if an item was not found.
-
Type
-
Promise.<ListItem>