This service can be accessed from the module:ct-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:ct-watchlist/WatchlistServiceEvents
.
Methods
create(name, erroropt, successopt)
A request to create a module:ct-watchlist/Watchlist
.
If the request is successful, an ADDED event will be raised (see
module:ct-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 |
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:ct-watchlist/WatchlistServiceEvents
).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
watchlists |
Array |
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.
get ById(id) → {module:ct-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.
get Watchlist Count() → {int}
Returns the number of watchlists.
Returns:
the number of watchlists.
- Type
- int
get Watchlists() → {Object}
Returns a snapshot of the watchlists.
Returns:
a watchlists object keyed by watchlist name.
- Type
- Object