Skip to content

Zero-dependency eventing and pub-sub library for the browser and Node.js.

License

Notifications You must be signed in to change notification settings

umanghome/evntr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Evntr

Zero-dependency eventing and pub-sub library for the browser and Node.js.


Installation

Browser

<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

Node.js

Install from NPM using npm i --save evntr, then

import Evntr from 'evntr';
const evntr = Evntr();

OR

const evntr = require('evntr')();

Usage

Listen for an event

evntr.on('myEvent', (some, data) => {
  console.log(some, data);
})

Emit an event

evntr.emit('myEvent', {
  hello: 'world'
}, {
  world: 'hello'
});

Remove a listener

evntr.off('myEvent', myListener);

License

MIT License © Umang Galaiya

About

Zero-dependency eventing and pub-sub library for the browser and Node.js.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published