class static
meteoJS/base/collection . Collection
Source: base/
Collection-class for Unique
-Objects
or objects of child classes.
- Implements
- Iterator
Properties
new Collection(options)
Parameter
Name | Type | Optional | Description |
---|---|---|---|
options |
|
|
Options. |
Properties
read-only
count integer
Count of the items in this collection.
read-only
itemIds Array of mixed
List of IDs (ordered list).
read-only
items Array of module:meteoJS/base/unique.Unique
Items (ordered list).
options Object
sortFunction (undefined or function())
Sort function for the items.
Methods
append(...items) → module:meteoJS/base/collection.Collection
Append an item to the collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
items |
|
New items. Value can be repeated. |
- Fires
- module:meteoJS/base/collection#add:item
- module:meteoJS/base/collection#remove:item
- module:meteoJS/base/collection#replace:item
- Returns
contains(item) → boolean
Is item appended to the collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
item |
|
Item. |
- Returns
-
boolean
If appended.
containsId(id) → boolean
Exists an ID in this collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID. |
- Returns
-
boolean
If exists.
getItemById(id) → module:meteoJS/base/unique.Unique
Returns item by ID, Unique-Object with undefined id, if ID doesn't exist.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID. |
- Returns
remove(...items) → module:meteoJS/base/collection.Collection
Removes an item from the collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
items |
|
Items to remove. Value can be repeated. |
- Fires
- module:meteoJS/base/collection#remove:item
- Returns
removeById(id) → module:meteoJS/base/collection.Collection
Removes an item by ID from the collection.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
id |
mixed |
|
ID of the item to delete. |
- Fires
- module:meteoJS/base/collection#remove:item
- Returns