axy-events
An event emitter implementation.
It is not related to DOM-events.
Features:
- add and remove listeners.
- create listeners with limited number of calls.
- event classes inheritance.
- stopPropagation() and preventDefault().
- handlers: bound context, arguments and data.
Classes and Interfaces
- Emitter
- SingleEmitter
- Emitter Options
- Event Object
- Listener Object
- Handler Format
- Emit Arguments
- TypeScript Interface
How to Use
NPM
npm install axy-events
Use (es6-module):
import Emitter from "axy-events";
emitter = new Emitter();
Default export of the library is Emitter class.
For CommonJS:
var Emitter = require("axy-events").default;
Browser (antiquated method)
Include the js-file from the /browser/
directory of this repo:
<script src="axy-events.min.js"></script>
var Emitter = axy.events;
// ...
Browser & NPM
Use webpack with NPM version.
TypeScript
See typescript section.
Building and testing
Required global gulp.
See gulpfile.js
for more details.