Caplin Trader 5.1.0

Interface: module:ct-watchlist/WatchlistContentsManager

module:ct-watchlist/WatchlistContentsManager

Used to modify the contents of a watchlist. As this may require a live data connection from a server to work correctly, methods are provided to pause and resume the connection.

Each component using a watchlist should obtain its own module:ct-watchlist/WatchlistContentsManager using module:ct-watchlist/Watchlist#getContentsManager.

When the component is hidden, it should call module:ct-watchlist/WatchlistContentsManager#pause to signify that it is no longer using the watchlist, so that any subscriptions to data sources can be paused when a watchlist is no longer in use.

Methods

append(subjects, erroropt, successopt)

Add records to the end of this watchlist.

Parameters:
Name Type Attributes Description
subjects Array.<string>

the array of subjects of the records to add.

error function <optional>

function to be called if the operation fails.

success function <optional>

function to be called when the operation completes successfully.

contains(subject) → {boolean}

Whether or not this watchlist contains a given record.

Parameters:
Name Type Description
subject string

The subject of the record to verify.

Returns:

true if the given subject is in this watchlist, otherwise false.

Type
boolean

destroy()

This method should be called when this module:ct-watchlist/WatchlistContentsManager will no longer be used, signifying to the watchlist that it can free up resources.

insert(subjects, index, erroropt, successopt)

Insert records into this watchlist at a given index.

Parameters:
Name Type Attributes Description
subjects Array.<string>

the array of subjects of the records to add.

index Integer

the insertion index.

error function <optional>

function to be called if the operation fails.

success function <optional>

function to be called when the operation completes successfully.

isPaused() → {boolean}

Is this module:ct-watchlist/WatchlistContentsManager's subscription paused.

Returns:

true if the contents manager subscription is paused, otherwise false.

Type
boolean

pause()

Signify to the module:ct-watchlist/Watchlist that the user of this contents manager is not actively using the watchlist.

remove(subjects, erroropt, successopt)

Remove records from this watchlist.

Parameters:
Name Type Attributes Description
subjects Array.<string>

the array of subjects to be removed.

error function <optional>

function to be called if the operation fails.

success function <optional>

function to be called when the operation completes successfully.

resume()

Signify to the module:ct-watchlist/Watchlist that the user of this contents manager is once again actively using the watchlist.