@codesmiths/event
v1.0.1
Published
mp event.js
Downloads
2
Readme
Installation
npm i @codesmiths/event
In mini program devtool menu: Tools => Build npm
How to use
Import Package
import event from @codesmiths/event
Event Listener
event.on('eventName', this, this.functionName)
Event Emitter
event.emit('eventName', data)
data is optional and it will get passed to the event listener callback function
Event Remover
event.remove('eventName', this)
It is a good practice to remove a event listener when your component gets detached or page gets unloaded.