Class: Hook

Hook(context)

Hooks allow for injecting functions that must all complete in order before finishing They will execute in parallel but all must finish before continuing Functions may return a promise if they are asycn. From epubjs/src/utils/hooks

Constructor

new Hook(context)

Parameters:
Name Type Description
context any

scope of this

Source:
Example
this.content = new Hook(this);

Methods

register() → {undefined}

Adds a function to be run before a hook completes

.

Adds a function to be run before a hook completes

Source:
Returns:

void

Type
undefined
Example
this.content.register(function(){...});

trigger() → {Promise}

Triggers a hook to run all functions

.

Triggers a hook to run all functions

Source:
Returns:

results

Type
Promise
Example
this.content.trigger(args).then(function(){...});

triggerSync() → {Array}

Triggers a hook to run all functions synchronously

.

Triggers a hook to run all functions synchronously

Source:
Returns:

results

Type
Array
Example
this.content.trigger(args).then(function(){...});