Skip to content

ghostborn/mitt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

mitt

一个微型的发布订阅模式js库

Install

npm i mitt-jialp

Usage

 import mitt from 'mitt'
 
 const emitter = mitt()
 
 // listen to an event
 emitter.on('foo', e => console.log('foo', e) )
 
 // listen to all events
 emitter.on('*', (type, e) => console.log(type, e) )
 
 // fire an event
 emitter.emit('foo', { a: 'b' })
 
 // clearing all events
 emitter.all.clear()
 
 // working with handler references:
 function onFoo() {}
 emitter.on('foo', onFoo)   // listen
 emitter.off('foo', onFoo)  // unlisten

About

一个微型的发布订阅模式js库

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors