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:
- Source:
Properties:
| Name |
Type |
Description |
Parallel |
String
|
|
Series |
String
|
|
Middleware |
String
|
|
Types of supported Hook
Type:
Methods
(async) _invokeMiddleware(coreFn, …args) → {Promise}
- Description:
- Builds and invokes a middleware chain around a core function.
Each observer receives (next, ...args) and must call next(...args) to continue the chain.
- Source:
Parameters:
| Name |
Type |
Attributes |
Description |
coreFn |
function
|
|
The core function to wrap |
args |
*
|
<repeatable>
|
Arguments to pass through the chain |
Returns:
-
Type
-
Promise
(async) invoke(…args) → {Promise}
- Description:
- 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, scope)
- Description:
- Adds an observer to the hook
- Source:
Parameters:
| Name |
Type |
Description |
observer |
function
|
Callback to be called when the hook is invoked |
scope |
*
|
Sets the scope of the observer |
untap(observer)
- Description:
- Removes an observer from the hook
- Source:
Parameters:
| Name |
Type |
Description |
observer |
function
|
|