Caplin Trader 5.1.0

Class: module:ct-sljsadapter/providers/StreamLinkTriggerService

module:ct-sljsadapter/providers/StreamLinkTriggerService(providedStreamlinkTriggerAPIopt)

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

Constructor

new module:ct-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 to be invoked on streamlink contrib error.

success function <optional>

callback to be invoked on successful trigger creation.

See:
  • ct-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 ct-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:
  • ct-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 ct-alerts/Trigger

The trigger to be disposed of.

error function <optional>

callback to be invoked on streamlink contrib error.

success function <optional>

callback to be invoked on successful trigger disposal.

See:
  • ct-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 ct-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:
  • ct-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