emit-machine

Simple event emitter for any js platform

Usage no npm install needed!

<script type="module">
  import emitMachine from 'https://cdn.skypack.dev/emit-machine';
</script>

README

About

Simple event emitter for any js platform

Install

npm i emit-machine

Usage

const EventEmitter = require('emit-machine');

const emitter = new EventEmitter;

// subscribtion to specified event
emitter.on('your_event', event => {
  console.log(event);
});

// sending data to subscribed callback functions
emitter.emit('your_event', { type: 'your_event', data: 1 });