store/List

Source:

Methods

(async) addEntry(entry) → {Promise.<Entry>}

Description:
  • Adds an entry to this list, on success the List entry will be returned (updated with latest modification date). The added entry will be marked as in need of a refresh due to stale inv-rel cache. However,since List entry is loaded it may be refreshed already when method is resolved, it depends if it is in the first page of the list.

Source:
Parameters:
Name Type Description
entry Entry

entry to add to the list.

Returns:
Type
Promise.<Entry>

forEach(func) → {Promise}

Description:
  • Executes a callback on each list members in the order provided by the list. If the provided function return false for one entry the iteration is stopped and the function is not called for consecutive entries.

Source:
Parameters:
Name Type Description
func function
Returns:

called with two parameters, the first a boolean saying if all entries where passed, the second an index telling how many entries iterated over.

Type
Promise

(async) getAllEntries() → {Promise.<Array.<Entry>>}

Description:
  • Loops through with forEach and accumulates the entries in a single array. Note! this might be memory intensive for large lists

Source:
See:
  • forEach
To Do:
  • add tests
Returns:
Type
Promise.<Array.<Entry>>

getAllEntryIds() → {Promise.<Array.<string>>}

Description:
  • Get a list of entry ids contained in this list.

Source:
Returns:

the promise will deliver an array of children entries in this list as ids (strings, not full URIs).

Type
Promise.<Array.<string>>

getEntries(page) → {Promise.<Array.<Entry>>}

Description:
  • Retrieves an array of entries contained in this list according to the current page and pagination settings.

Source:
Parameters:
Name Type Default Description
page number 0

the page to request an array of entries for, first page is numbered 0.

Returns:

the promise will return an entry-array.

Type
Promise.<Array.<Entry>>

getLimit() → {integer}

Description:
  • Get the max amount of entries to include in each page during pagination.

Source:
Returns:
Type
integer

getSize() → {number}

Description:
  • Get size of list.

Source:
Returns:

the amount of entries in the list, -1 if unknown.

Type
number

needRefresh()

Description:
  • Will unset things since the cache is stale...

Source:

(async) removeEntry(entry) → {Promise}

Description:
  • Removes an entry from this list, on success the List entry will be returned (updated with latest modification date). The removed entry will not be updated but marked as in need of a refresh due to stale inv-rel cache. However,since List entry is loaded it may be refreshed already when method is resolved, it depends if it is in the first page of the list.

Source:
Parameters:
Name Type Description
entry Entry

entry to be removed from the list.

Returns:
Type
Promise

(async) setAllEntryIds(entries, callType) → {Promise.<Entry>}

Description:
  • Set a list of entry ids to be contained in this list.

Source:
Parameters:
Name Type Description
entries Array.<string>

array of entry ids (as strings, not full URIs).

callType string
Returns:
Type
Promise.<Entry>

setLimit(limit) → {List}

Description:
  • Set the max amount of entries to include in each page during pagination.

Source:
Parameters:
Name Type Description
limit integer
Returns:

allows chaining of set-operations.

Type
List

setSort(sortParams) → {List}

Description:
  • Sets the sort order when loading entries contained in this list.

Source:
Parameters:
Name Type Description
sortParams Object

same object structure as the sort parameter in optionalLoadParameters in EntryStore#getEntry method.

Returns:

allows chaining of set-operations.

Type
List