observer-emit
TypeScript icon, indicating that this package has built-in type declarations

1.0.1ย โ€ขย Publicย โ€ขย Published

observer-emit

๐Ÿ‘€ A Node.js event emitter works in the browser.

NPM version

Install

using npm

$ npm i observer-emit

using yarn

$ yarn add observer-emit

using pnpm

$ pnpm i observer-emit

Usage

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')

License

MIT License ยฉ 2022 Akashi Sai

Package Sidebar

Install

npm i observer-emit

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

7.36 kB

Total Files

6

Last publish

Collaborators

  • akashi_sai