👀 A Node.js event emitter works in the browser.
$ npm i observer-emit
$ yarn add observer-emit
$ pnpm i observer-emit
import observer from 'observer-emit'
observer.on('asuka', () => console.log('asuka', 1))
observer.on('nagi', () => console.log('nagi'))
observer.off('asuka')
observer.on('asuka', () => console.log('asuka', 2))
observer.emit('asuka') // asuka 2
observer.emit('nagi') // nagi
observer.once('ume', () => console.log('ume'))
observer.emit('ume') // ume
observer.emit('ume')
observer.emit('ume')
MIT License © 2022 Akashi Sai