class static
meteoJS/synview/collection . Collection
Source: synview/
Collection of items. Items have at least a getId() method, which returns a unique ID.
new Collection()
Methods
append(item) → module:meteoJS/synview/collection.Collection
Append an item to the collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
item |
object |
|
New item. |
- Fires
- module:meteoJS/synview/collection#add:item
- module:meteoJS/synview/collection#replace:item
- Returns
containsId(id) → boolean
Returns if an ID exists in this collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID. |
- Returns
-
boolean
If exists.
getCount() → integer
Returns count of items in this collection.
- Returns
-
integer
Count.
getIndexById(id) → integer
Returns index of the item in this collecition, -1 if not existant.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID. |
- Returns
-
integer
Index.
getItemById(id) → (Object or undefined)
Returns item by ID, undefined if ID doesn't exist.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID. |
- Returns
-
(Object or undefined)
Item.
getItemIds() → Array of mixed
Returns a list of IDs (in order as appended).
- Returns
-
Array of mixed
List of IDs.
getItems() → Array of Object
Returns items (in order as appended).
- Returns
-
Array of Object
Items.
remove(id) → module:meteoJS/synview/collection.Collection
Removes an item from the collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID of the item to delete. |