Hook

core. Hook

Allows observers to tap into to a specific piece of code, and execute their own arbitrary code

Constructor

new Hook()

Source:

Members

hasObservers

Description:
  • Whether this hook has any observer functions
Source:
Whether this hook has any observer functions

(static) Types :Object

Description:
  • Types of supported Hook
Source:
Properties:
Name Type Description
Parallel String
Series String
Types of supported Hook
Type:
  • Object

Methods

(async) invoke(…args) → {Promise}

Description:
  • Invokes all observers
Source:
Parameters:
Name Type Attributes Description
args * <repeatable>
Arguments to be passed to observers
Returns:
Type
Promise

onInvoke()

Description:
  • Returns a promise which is resolved when the hook is successfully invoked. If hook fails, the promise is rejected with the error
Source:
Returns:
Promise

tap(observer)

Description:
  • Adds an observer to the hook
Source:
Parameters:
Name Type Description
observer function Callback to be called when the hook is invoked

untap(observer)

Description:
  • Removes an observer from the hook
Source:
Parameters:
Name Type Description
observer function