Package Exports
- evnty
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (evnty) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Evnty
0-Deps, simple, fast, for browser and node js anonymous event library
Interface
declare type Unsubscribe = () => void;
declare type Listener = (...args: any[]) => void;
interface Event {
off(listener: Listener): void;
on(listener: Listener): Unsubscribe;
once(listener: Function): Unsubscribe;
readonly size: Number;
}
Usage
import Event from 'evnty';
const event = new Event();
const unsubscribe = event.on(value => {
console.log('EVENT VALUE IS', value);
});
event('test');
unsubscribe();
License
License The MIT License Copyright (c) 2019 Ivan Zakharchanka