Caplin Trader 4.8.0

Interface: module:caplin/core/DelayedReadinessService


Interface that must be implemented by a service that is not immediately ready for use.

This represents an interface, and should not normally be constructed.

This is an example of a service that requires an asynchronous network request before construction to obtain service data, e.g. permission data or HTML/JSON data from the server.

Upon construction the service can trigger an asynchronous request. When it has received the data it requires and is ready to use then the service must call serviceIsReady on the module:caplin/core/DelayedReadinessServiceListeners that have been added as listeners to the Service via the addDelayedReadinessServiceListener method.

If the service depends on other caplin.core.DelayedReadinessServices then it should specify that by returning them as an array in the getServiceDependencies method.



(static) getServiceDependencies() → {Array}

Returns the list of services that this service requires to be in a ready state before it can be constructed. Return an empty array otherwise. This method should not be on the prototype but should be a static method on the service class. Only other caplin.core.DelayedReadinessServices should be specified.
  • module:caplin/sljsadapter/providers/StreamLinkPermissionService.getServiceDependencies
  • module:caplin/sljsadapter/providers/StreamLinkWatchlistService.getServiceDependencies
an array of {String}s listing the services that this service depends on.


Registers a DelayedReadinessServiceListener object, which is used to notify when the service is ready to use.
Name Type Description
oDelayedReadinessServiceListener module:caplin/core/DelayedReadinessServiceListener The service readiness listener.
  • module:caplin/sljsadapter/providers/StreamLinkPermissionService#addDelayedReadinessServiceListener
  • module:caplin/sljsadapter/providers/StreamLinkWatchlistService#addDelayedReadinessServiceListener