zen-mitt
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

zen-mitt

light-weight(187B min+gzip) typesafe event emitter

const events = mitt<{
  foo: number
  arr: string[]
  param: [name: string, age?: number]
}>()
events.on('foo', console.log)
events.emit('foo', 1)

events.on('arr', console.log)
events.emit('arr', ['test'])
events.off('arr')

events.once('param', console.log)
events.emit('param', 'test', 1)

events.off() // clear all listeners

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.3.0
    155
    • latest

Version History

Package Sidebar

Install

npm i zen-mitt

Weekly Downloads

155

Version

0.3.0

License

MIT

Unpacked Size

7.85 kB

Total Files

7

Last publish

Collaborators

  • subframe7536