hapi-signals
Signals and events for Hapi.
Install
$ npm install hapi-signals
Usage
It decorates the server with the method addSignal. This method takes a string and adds a signals with that name. It also exposes the signals and decorates the requests with the signals object.
A signal has the following methods:
- dispatch: fires all callbacks with the arguments provided to this method.
- add: registers a callback to be called when this signal dispatches. The call back takes as arguments whatever is passed to the dispatch method.
- once: same as add but runs only once
The plugin can also be passed the following options:
- signals: string or array of strings of names of signals to add during registration
Example
const Hapi = ; const server = /* options */; // some other stuff ... server;
License
MIT