Class: Subscription

Subscription

Base class of the specialized dc List.


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
INIT number 0
SUBSCRIBED number 1
READY number 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
baseTag string
query Array.<olympe.dc.Transformer> <nullable>
parameters olympe.dc.query.Parameters
Returns:
Type
string

createSync(index, tag)

Creates and adds a sync to the subscription.

Parameters:
Name Type Description
index string

Sync index.

tag string

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
callback function

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.

Type
olympe.dc.Transformer.Path

getQuery()

Gets the list query

Returns:

The transformers.

Type
Array.<olympe.dc.Transformer>

isCurrentlyReady()

Returns true if the list is currently ready.

Returns:

true if the list is currently ready.

Type
boolean

isCurrentlySubscribed()

Checks whether the list is currently subscribed or not.

Returns:

true if this list is currently subscribed.

Type
boolean

isReady()

Checks if the list is ready (ie. all instances have been added and have ranks).

Returns:

true when is the list is ready, false otherwise.

Type
olympe.df.Proxy.<olympe.df.OBoolean>

offReady(id)

Unregisters a previously registered ready callback.

Parameters:
Name Type Description
id string

Callback unique identifier.


onReady(callback [, id])

Registers an on subscription ready callback.

Parameters:
Name Type Argument Description
callback olympe.dc.query.Subscription.ReadyCallback

The function to invoke on Ready.

id string <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
index string

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
orderedIndexes Array.<string>

setSubscribed()

Marks the list as subscribed

Type Definitions


ReadyCallback(subscription)

Parameters:
Name Type Description
subscription olympe.dc.query.Subscription