This service can be accessed from the
module:caplin/core/ServiceRegistry
, using the alias
caplin.watchlist.watchlist-service
.
This interface uses emitr allowing services implementing this interface to trigger events.
The service will emit events defined in module:caplin/watchlist/WatchlistServiceEvents
.
- Implementations:
Methods
-
create(name, erroropt, successopt)
-
A request to create a
module:caplin/watchlist/Watchlist
.If the request is successful, an ADDED event will be raised (see
module:caplin/watchlist/WatchlistServiceEvents
) for the newly created watchlist.Parameters:
Name Type Attributes Description name
String The user friendly name for the watchlist. error
function <optional>
A callback that will be invoked if the request fails. success
function <optional>
A callback that will be invoked when the request is fulfilled. The callback will be passed a single parameter which is the created module:caplin/watchlist/Watchlist
. -
dispose(watchlists, erroropt, successopt)
-
A request to dispose of the given watchlists, removing them from the user's list of watchlists.
If the request is successful, a REMOVED event will be raised for each watchlist removed (see
module:caplin/watchlist/WatchlistServiceEvents
).Parameters:
Name Type Attributes Description watchlists
Array.<module:caplin/watchlist/Watchlist> The watchlists to dispose of. error
function <optional>
A callback that will be invoked if the request fails. success
function <optional>
A callback that will be invoked when the request is fulfilled. -
dispose()
-
Disposes of any listeners and resources that were used by the service.
-
getById(id) → {module:caplin/watchlist/Watchlist}
-
Returns the watchlist with the given id. If there is no watchlist with the given id, a special "null" watchlist will be returned instead.
Parameters:
Name Type Description id
String The unique identifier of the required watchlist. Returns:
the watchlist with the given id. -
getWatchlistCount() → {int}
-
Returns the number of watchlists.
Returns:
the number of watchlists.- Type
- int
-
getWatchlists() → {Object}
-
Returns a snapshot of the watchlists.
Returns:
a watchlists object keyed by watchlist name.- Type
- Object