Confirmed users
596
edits
m (→Comparation of items: spelling) |
m (→Collection: remove " : function") |
||
| Line 60: | Line 60: | ||
* Adds one item to the list | * Adds one item to the list | ||
* @param item {Object} any JS object | * @param item {Object} any JS object | ||
add | add(item) | ||
* Removes one item from the list | * Removes one item from the list | ||
* @param item {Object} any JS object | * @param item {Object} any JS object | ||
remove | remove(item) | ||
* Add all items in |coll| to this list. | * Add all items in |coll| to this list. | ||
| Line 72: | Line 72: | ||
* Note: This is intentionally not overloading |add|. | * Note: This is intentionally not overloading |add|. | ||
* @param coll {Collection or JS Array} | * @param coll {Collection or JS Array} | ||
addAll | addAll(coll) | ||
* Removes all items in |coll| from this list | * Removes all items in |coll| from this list | ||
* @param coll {Collection or JS Array} | * @param coll {Collection or JS Array} | ||
removeAll | removeAll(coll) | ||
* Removes all items from the list. | * Removes all items from the list. | ||
clear | clear() | ||
* The number of items in this list | * The number of items in this list | ||
* @returns {Integer} (always >= 0) | * @returns {Integer} (always >= 0) | ||
length (getter) | |||
* Whether there are items in this list | * Whether there are items in this list | ||
* @returns {Boolean} | * @returns {Boolean} | ||
isEmpty (getter) | |||
* Checks whether this item is in the list. | * Checks whether this item is in the list. | ||
* @returns {Boolean} | * @returns {Boolean} | ||
contains | contains(item) | ||
* Returns all items contained in this list, | * Returns all items contained in this list, | ||
| Line 105: | Line 105: | ||
* | * | ||
* @returns {Array} new JS array with all items | * @returns {Array} new JS array with all items | ||
contents | contents() | ||
* Provides an iterator, i.e. allows to write: | * Provides an iterator, i.e. allows to write: | ||
| Line 111: | Line 111: | ||
* for each (let item in coll) | * for each (let item in coll) | ||
* debug(item); | * debug(item); | ||
__iterator__ | __iterator__ | ||
* Pass an object that will be called when | * Pass an object that will be called when | ||
| Line 117: | Line 117: | ||
* If you call this twice for the same observer, the second is a no-op. | * If you call this twice for the same observer, the second is a no-op. | ||
* @param observer {CollectionObserver} | * @param observer {CollectionObserver} | ||
registerObserver | registerObserver(observer) | ||
* undo |registerObserver| | * undo |registerObserver| | ||
* @param observer {CollectionObserver} | * @param observer {CollectionObserver} | ||
unregisterObserver | unregisterObserver(observer) | ||
== KeyValueCollection == | == KeyValueCollection == | ||