Tinier event emitter
yarn add mitr
import Emitter from 'mitr'
const mitr = new Emitter()
mitr.on('complete', (data) => {
console.log('callbacks are still cool!')
doSomethingWithData(data);
})
fetch('/api/make/coffee').then((data) => {
mitr.emit('complete', data)
})
Adds an event listener for event, invoking callback
Removes all events of type $event
Emit an event to all $event listeners with optional data