new Collection(options)

Parameter

Name Type Optional Description

options

 

 

Options.

Implements
Iterator
Fires
module:meteoJS/base/collection#add:item
module:meteoJS/base/collection#remove:item
module:meteoJS/base/collection#replace:item

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

module:meteoJS/base/unique.Unique

 

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

module:meteoJS/base/collection.Collection This.

contains(item) → boolean

Is item appended to the collection.

Parameter

Name Type Optional Description

item

module:meteoJS/base/unique.Unique

 

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

module:meteoJS/base/unique.Unique Item.

remove(...items) → module:meteoJS/base/collection.Collection

Removes an item from the collection.

Parameter

Name Type Optional Description

items

module:meteoJS/base/unique.Unique

 

Items to remove.

Value can be repeated.

Fires
module:meteoJS/base/collection#remove:item
Returns

module:meteoJS/base/collection.Collection This.

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

module:meteoJS/base/collection.Collection This.