Caplin Trader 4.7.1

Class: module:caplin/sljsadapter/providers/StreamLinkTriggerService

module:caplin/sljsadapter/providers/StreamLinkTriggerService

The StreamLinkTriggerService is a wrapper around streamlink's alerts module that translates trigger objects from streamlink into caplin.alerts.Trigger objects and sends them to components that are listening via the emitr on method. This class listens to the streamlink alerts API. It implements module:caplin/alerts/TriggerService.

Constructor

new module:caplin/sljsadapter/providers/StreamLinkTriggerService(providedStreamlinkTriggerAPIopt)

Parameters:
Name Type Attributes Default Description
providedStreamlinkTriggerAPI caplin.streamlink.alerts.TriggerService <optional>
new caplin.streamlink.alerts.TriggerService() provide a fake streamlink API for testing

Methods

create(properties, erroropt, successopt)

This method is meant to be invoked by UI components wishing to create a new trigger. It uses the streamlink API to add a trigger.
Parameters:
Name Type Attributes Description
properties Object A map including the required properties subject and condition, both of which must be strings, from whence a trigger will be created.
error function <optional>
callback invoked on streamlink contrib error.
success function <optional>
callback invoked on successful trigger creation.
See:
  • caplin/alerts/TriggerService#create
Throws:
If required properties are not included, or if error and success are not functions.
Type
br/Errors.INVALID_PARAMETERS

disableTrigger(trigger, erroropt, successopt)

Disables a trigger in the system.

Parameters:
Name Type Attributes Description
trigger caplin/alerts/Trigger The trigger to be disabled.
error function <optional>
callback invoked on streamlink contrib error.
success function <optional>
callback invoked on successful trigger disabling.
See:
  • caplin/alerts/TriggerService#disableTrigger
Throws:
If trigger parameter is not a Trigger, not found in the current list, or if error and success are not functions.
Type
br/Errors.INVALID_PARAMETERS

dispose(trigger, erroropt, successopt)

This method is meant to be invoked by UI components wishing to dispose of a trigger. It uses the streamlink API to remove a trigger.
Parameters:
Name Type Attributes Description
trigger caplin/alerts/Trigger The trigger to be disposed of.
error function <optional>
callback invoked on streamlink contrib error.
success function <optional>
callback invoked on successful trigger disposal.
See:
  • caplin/alerts/TriggerService#dispose
Throws:
If trigger parameter is not a Trigger, not found in the current list, or if error and success are not functions.
Type
br/Errors.INVALID_PARAMETERS

enableTrigger(trigger, erroropt, successopt)

Enables a trigger in the system.

Parameters:
Name Type Attributes Description
trigger caplin/alerts/Trigger The trigger to be enabled.
error function <optional>
callback invoked on streamlink contrib error.
success function <optional>
callback invoked on successful trigger enabling.
See:
  • caplin/alerts/TriggerService#enableTrigger
Throws:
If trigger parameter is not a Trigger, not found in the current list, or if error and success are not functions.
Type
br/Errors.INVALID_PARAMETERS