Caplin Trader 4.0.3

Interface: module:caplin/watchlist/WatchlistContentsManager

module:caplin/watchlist/WatchlistContentsManager

Summary

This is in beta and therefore subject to API changes.

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:caplin/watchlist/WatchlistContentsManager using module:caplin/watchlist/Watchlist#getContentsManager. When the component is hidden, it should call module:caplin/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.
Implementations:

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.
Implementations:
Returns:
true if the given subject is in this watchlist, otherwise false.
Type
boolean

destroy()

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

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.
Implementations:

pause()

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

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.
Implementations:

resume()

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