Zero-dependency eventing and pub-sub library for the browser and Node.js.
<script src="path/to/evntr.min.js" type="text/javascript"></script>
<script>
var evntr = Evntr();
</script>
Evntr is also available from unpkg: https://unpkg.com/evntr@1.0.0/evntr.min.js
Install from NPM using npm i --save evntr
, then
import Evntr from 'evntr';
const evntr = Evntr();
OR
const evntr = require('evntr')();
evntr.on('myEvent', (some, data) => {
console.log(some, data);
})
evntr.emit('myEvent', {
hello: 'world'
}, {
world: 'hello'
});
evntr.off('myEvent', myListener);