Caplin Trader 4.7.1

Class: module:caplin/sljsadapter/watchlist/StreamLinkWatchlistContentsManager

module:caplin/sljsadapter/watchlist/StreamLinkWatchlistContentsManager

You should never construct this class by yourself; use module:caplin/sljsadapter/watchlist/StreamLinkWatchlist#getContentsManager to construct it for you.

This class has methods for manipulating the list of records for the watchlist that instantiates it. When getContentsManager is called, the watchlist subscribes to its streamlink subject. When your component is hidden, you should call pause so that the watchlist knows you are no longer actively viewing its contents. When all interested parties have paused their ContentsManagers, the subscription will be paused. When you are done with the watchlist, call destroy.

Constructor

new module:caplin/sljsadapter/watchlist/StreamLinkWatchlistContentsManager()

Implements:

Methods

append(subjects, erroropt, successopt)

Appends a list of records to the end of the watchlist's list. Makes streamlink contrib to add records to the end of this watchlist and add the request to list of pending requests. Calls success when streamlink adds all the requested records. If all the records have not been added after the timeout, error is called.
Parameters:
Name Type Attributes Description
subjects Array.<string> the array of subjects to add.
error function <optional>
function to be called if operation fails
success function <optional>
function to be called if operation succeeds
Implements:
See:
Throws:
If the contents manager is paused or destroyed.
Type
module:br/Errors.ILLEGAL_STATE

contains(subject) → {Boolean}

Determines whether or not this watchlist contains the given subject.
Parameters:
Name Type Description
subject string Subject to verify
Implements:
Throws:
If the contents manager is paused or destroyed.
Type
module:br/Errors.ILLEGAL_STATE
Returns:
true if the given subject is in this watchlist, otherwise false.
Type
Boolean

destroy()

This method should be called when this contents manager will no longer be used.
Implements:
Throws:
If the contents manager is already destroyed.
Type
module:br/Errors.ILLEGAL_STATE

insert(subjects, index, erroropt, successopt)

Inserts a list of records at the given index into the watchlist. Makes streamlink contrib to insert records into this watchlist and add the request to list of pending requests. Calls success when streamlink adds the requested subject; or if all the records have not been added after the timeout, error is called.
Parameters:
Name Type Attributes Description
subjects Array.<string> the array of subjects to add.
index number where the records should be inserted. Must be a non-infinite, positive integer.
error function <optional>
function to be called if operation fails
success function <optional>
function to be called if operation succeeds
Implements:
See:
Throws:
If the contents manager is paused or destroyed.
Type
module:br/Errors.ILLEGAL_STATE

isPaused() → {boolean}

Is the contents manager actively subscribed
Implements:
Throws:
If the contents manager is destroyed.
Type
module:br/Errors.ILLEGAL_STATE
Returns:
true if the contents manager subscription is paused, otherwise false.
Type
boolean

pause()

Change the state of this object to paused, and remove it from the list of active contents managers. When no more contents managers are actively using a Watchlist, the subscription to the watchlist container subject will be stopped. If already paused, do nothing. Your component should call this method when it is hidden.
Implements:
Throws:
If the contents manager is already destroyed.
Type
module:br/Errors.ILLEGAL_STATE

remove(subjects, erroropt, successopt)

Removes a list of records from the watchlist. Makes streamlink contrib to remove records from this watchlist and add the request to list of pending requests. Calls success when streamlink removes all the requested records; or if all the records have not been removed after the timeout, error is called.
Parameters:
Name Type Attributes Description
subjects Array.<string> the array of subjects to remove.
error function <optional>
function to be called if operation fails
success function <optional>
function to be called if operation succeeds
Implements:
See:
Throws:
If the contents manager is paused or destroyed.
Type
module:br/Errors.ILLEGAL_STATE

resume()

Change the state of this object to unpaused, and add it to the watchlist's list of active contents managers. If no contents managers were previously using a watchlist, a subscription to the watchlist container subject will be started. If already unpaused, do nothing.

Your component should call this method when it is unhidden.

Implements:
Throws:
If the contents manager is already destroyed.
Type
module:br/Errors.ILLEGAL_STATE