Methods
addCacheUpdateListener(listener)
Parameters:
Name | Type | Description |
---|---|---|
listener |
function |
addPromise(loadID, loadPromise)
Store the promise for loading something.
Parameters:
Name | Type | Description |
---|---|---|
loadID |
String | |
loadPromise |
Promise |
allNeedRefresh()
Marks all entries as in need of refresh and consequently messages all listeners with the allEntriesNeedRefresh topic.
cache(entry, silentlyopt)
Add or update the entry to the cache. All listeners will be notified unless silently is specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
entry |
Entry | ||
silently |
Boolean |
<optional> |
listeners will be notified unless true is specified. |
cacheAll(entryArr, silentlyopt)
A convenience method for caching multiple entries.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
entryArr |
Array.<Entry> | ||
silently |
Boolean |
<optional> |
clear()
Clears the cache from all cached entries. Warning: all references to entries needs to be discarded as they will not be kept in sync with changes.
get(entryURI) → {Entry|undefined}
Retrieve the entry from it's URI.
Parameters:
Name | Type | Description |
---|---|---|
entryURI |
String |
Returns:
- Type
- Entry | undefined
getByResourceURI(uri) → {Set.<Entry>}
Retrieve all entries that have the specified uri as resource. Note that since several entries (e.g. links) may have the same uri as resource this method returns an array. However, in many situations there will be zero or one entry per uri.
Parameters:
Name | Type | Description |
---|---|---|
uri |
String |
Returns:
always returns a set, may be empty though.
- Type
- Set.<Entry>
getPromise(loadID) → {Promise|undefined}
Retrieve a load promise.
Parameters:
Name | Type | Description |
---|---|---|
loadID |
String |
Returns:
- Type
- Promise | undefined
messageListeners(topic, affectedEntryopt)
Agreed topics are: allEntriesNeedRefresh - all entries are now in need of refresh, typically happens after a change of user(sign in) needRefresh - the specified entry need to be refreshed. refreshed - the specified entry have been refreshed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
topic |
String | ||
affectedEntry |
Entry |
<optional> |
needRefresh(entry) → {boolean}
Tells whether the entry is in need of a refresh from the repository.
Parameters:
Name | Type | Description |
---|---|---|
entry |
Entry |
Returns:
- Type
- boolean
removeCacheUpdateListener(listener)
Parameters:
Name | Type | Description |
---|---|---|
listener |
function |
removePromise(loadID)
Remove the promise responsible for loading something.
Parameters:
Name | Type | Description |
---|---|---|
loadID |
String |
setRefreshNeeded(entry, silentlyopt)
Marks an entry as in need of refresh from the store. All listeners are notified of the entry now being in need of refreshing unless silently is set to true.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
entry |
Entry | ||
silently |
Boolean |
<optional> |
unCache(entry)
Removes a single entry from the cache.
Parameters:
Name | Type | Description |
---|---|---|
entry |
Entry | the entry to remove. |