y-event
Advanced tools
Weekly downloads
Readme
A event system could emit first, register later.
Or works as normal
npm i -D y-event
# or
yarn add --dev y-event
import event from 'y-event'
// emit first, register later
event.$always('event1')
event.$on('event1', () => {
console.log('event1 works') // event1 works
})
// normal use
event.$on('event2', (...args) => {
console.log('event2', ...args)
})
event.$emit('event2', 1, 2, 3) // event2, 1, 2, 3
// off
event.$off('event2')
event.$emit('event2') // nothing happens
// invoke once
event.$once('event3', () => {
console.log('event3')
})
event.$emit('event3') // 'event 3'
event.$emit('event3')
Copyright (c) 2017-present, Yuchen Liu
FAQs
Event system
The npm package y-event receives a total of 628 weekly downloads. As such, y-event popularity was classified as not popular.
We found that y-event demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.