event-handle
Events with closures.
Install
npm install event-handle
or yarn add event-handle
Import
; // ES6;const EventHandle = ; // CommonJS / Node.js
Example
// Create an event.let demoStarted = EventHandle; // Create a handler.EventHandle; // options: , { prepend: false, once: false } // Create another handler.let remove = demoStarted; // Trigger the event, calling all handlers.; // Remove the handler.console; // Other functions:console;console; // defined if create was passed an id.console;console;
See also:
- Test code in
spec/index.spec.ts
- Example code in
examples/
API
See: docs/API.md