1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-12-18 16:41:58 +00:00

Feathers: event listeners

This commit is contained in:
Julien Le Coupanec 2018-02-04 17:45:17 +00:00
parent 2cd1e38b0e
commit a27ab16eb9

View File

@ -87,6 +87,7 @@ myService.hooks(hooks) // register hooks for this se
myService.publish([event, ] publisher) // register an event publishing callback myService.publish([event, ] publisher) // register an event publishing callback
myService.mixin(mixin) // extends the functionality of a service myService.mixin(mixin) // extends the functionality of a service
myService.on(eventname, listener) // registers a listener method for the given eventname myService.on(eventname, listener) // registers a listener method for the given eventname
myService.once(eventname, listener) // registers a listener method for the given eventname that will be triggered only one time
myService.emit(eventname, data) // emits the event eventname to all event listeners myService.emit(eventname, data) // emits the event eventname to all event listeners
myService.removeListener(eventname, [ listener ]) // removes all listeners (or the given listener) for eventname myService.removeListener(eventname, [ listener ]) // removes all listeners (or the given listener) for eventname