new Subscription(id, baseTag, query)
Creates an instance of Subscription.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
id |
string | List identifier. |
|
baseTag |
olympe.df.POString | string | Starting instance tag. |
|
query |
Array.<olympe.dc.Transformer> |
<nullable> |
The transformers. |
Extends
Members
-
<static> STATE :number
-
Type:
- number
Properties:
Name Type Default Description INITnumber 0 SUBSCRIBEDnumber 1 READYnumber 2 -
context
-
Methods
-
<static> generateId(baseTag, query, parameters)
-
Generate the id of the specified subscription which is the same for two subscriptions with the same query
Parameters:
Name Type Argument Description baseTagstring queryArray.<olympe.dc.Transformer> <nullable>
parametersolympe.dc.query.Parameters Returns:
- Type
- string
-
createSync(index, tag)
-
Creates and adds a sync to the subscription.
Parameters:
Name Type Description indexstring Sync index.
tagstring Instance tag.
-
forEachCurrentRank(callback)
-
Executes the specified callback for each defined rank (through the setRank method).
Note: the keys for which there is a rank defined can be different than the ones for which a value is defined!
Parameters:
Name Type Description callbackfunction Function to invoke on each rank.
-
getBaseTag()
-
Gets the list's base tag.
Returns:
The tag.
- Type
- olympe.df.POString | string
-
getId()
-
Gets the list identifier.
Returns:
The ID.
- Type
- string
-
getPath()
-
Returns the path object containing all the path from the result instances to the base instance.
Returns:
The path.
-
getQuery()
-
Gets the list query
Returns:
The transformers.
- Type
- Array.<olympe.dc.Transformer>
-
isCurrentlyReady()
-
Returns true if the list is currently ready.
Returns:
trueif the list is currently ready.- Type
- boolean
-
isCurrentlySubscribed()
-
Checks whether the list is currently subscribed or not.
Returns:
trueif this list is currently subscribed.- Type
- boolean
-
isReady()
-
Checks if the list is ready (ie. all instances have been added and have ranks).
Returns:
truewhen is the list is ready,falseotherwise. -
offReady(id)
-
Unregisters a previously registered ready callback.
Parameters:
Name Type Description idstring Callback unique identifier.
-
onReady(callback [, id])
-
Registers an on subscription ready callback.
Parameters:
Name Type Argument Description callbackolympe.dc.query.Subscription.ReadyCallback The function to invoke on
Ready.idstring <optional>
ID for the registration, a unique one will be created if omitted.
Returns:
Callback unique identifier.
- Type
- string
-
<package> release()
-
Decrements the retain count and return the current counter value. Note: when the retains count reaches 0, the list destroys itself
Returns:
- Type
- number
-
removeSync(index)
-
Removes a sync from the subscription.
Parameters:
Name Type Description indexstring Sync index.
-
<package> retain()
-
Increments the retain count.
-
setRanks(orderedIndexes)
-
Handles list items rank update as provided by the ranking managers
Parameters:
Name Type Description orderedIndexesArray.<string> -
setSubscribed()
-
Marks the list as subscribed
Type Definitions
-
ReadyCallback(subscription)
-
Parameters:
Name Type Description subscriptionolympe.dc.query.Subscription
Olympe SDK