- Modern
- For Node.js and browsers
- 300 bytes minified and gzipped
yarn add eventstop
You can also use the UMD version via https://unpkg.com/eventstop
const EventStop = require('eventstop')
const event = new EventStop()
// subscribe an event
const unsubscribe = event.subscribe('ready', msg => {
console.log('message:', msg)
})
event.emit('ready', 'hola')
//=> hola
// unsubscribe
unsubscribe()
Return a function which would execute unsubscribe(event, handler)
when you call it.
Like .subscribe
but only trigger handler
once.
Type: string
Type: function
Type: string
Same args to .subscribe
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
eventstop © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @rem_rin_rin