mixinEventEmitter
MMO.core · 1 symbol · generated 5 Oct 2026
mixinEventEmitter
EventEmitter.js:15- Namespace
MMO.core- Extends
extendClass
Index
| eventNames readonly accessor | NOTE: only the string names. | |
| onFind(name, listener, scope) | Find listener. | |
| onExists(name) | ||
| eventBindings(name) | The live list of bindings registered for an event. | |
| loopEventsByScope(scope) generator | Yield all events concerning a given scope | |
| on(name, listener, scope, last) | Add a listener | |
| once(name, listener, scope, last) | Add a listener for one time | |
| onWait(event, resolvedValue, last) async | Async on | |
| off(name, listener, scope) | Remove listener | |
| offScope(scope) | Remove all listeners of a given scope | |
| offAll() | Drop every listener of every event at once. | |
| emit(name, args) | Emit an event | |
| emitAsync(name, args) | Emit event on an animation frame (asynchronously). | |
| emitAsyncLock() | Lock the emit queue, so it is not put on animation frame until it is unlocked | |
| emitAsyncUnlock() | Unlock the emit queue |
Properties1
eventNames
readonlyaccessorEventEmitter.js:49NOTE: only the string names. A Symbol event is not enumerated by Object.keys.
- Type
Array<string>
Methods14
onFind(name, listener, scope)
EventEmitter.js:23Find listener.
| name | string | the event's name |
| listener | Function | null | if null will look for listener with the right scope |
| scope = false | false | null | Object | if != false, look for listener with the right scope |
| returns | null | MMO.core.Binding |
onExists(name)
EventEmitter.js:41| name | string | Symbol | |
| returns | boolean | number | falsy when the event carries no listener |
eventBindings(name)
EventEmitter.js:58The live list of bindings registered for an event. Do not mutate it: use off/offScope.
| name | string | Symbol | |
| returns | Array<MMO.core.EventBinding> | empty when nothing is registered |
loopEventsByScope(scope)
generatorEventEmitter.js:67Yield all events concerning a given scope
| scope | object | the scope to look for in EventBinding |
on(name, listener, scope, last)
EventEmitter.js:86Add a listener
| name | string | Symbol | |
| listener | Function | MMO.core.EventBinding | |
| scope = null | null | Object | the scope to call the listener with (ignore when listener is an EventBinding) |
| last = true | Boolean | if false, set the listener as head of listeners chain |
| returns | MMO.core.EventBinding |
once(name, listener, scope, last)
EventEmitter.js:109Add a listener for one time
| name | string | Symbol | |
| listener | Function | |
| scope = null | null | Object | the scope to call the listener with |
| last = true | Boolean | if false, unshift the listener instead of push |
| returns | MMO.core.EventBinding |
onWait(event, resolvedValue, last)
asyncEventEmitter.js:121Async on
| event | string | Symbol | |
| resolvedValue = undefined | ||
| last = true | Boolean | if false, unshift the listener instead of push |
| returns | void |
off(name, listener, scope)
EventEmitter.js:134Remove listener
| name | string | Symbol | the event's name |
| listener | Function | MMO.core.EventBinding | null | if null will look for binding with the right scope |
| scope = false | false | null | Object | if != false, look for binding with the right scope |
| returns | MMO.core.EventBinding | null |
offScope(scope)
EventEmitter.js:168Remove all listeners of a given scope
| scope | Object | |
| returns | void |
offAll()
EventEmitter.js:178Drop every listener of every event at once.
emit(name, args)
EventEmitter.js:191Emit an event
| name | string | Symbol | |
| ...args | ... | the arguments to pass to the listeners |
| returns | int | the number of listener called |
emitAsync(name, args)
EventEmitter.js:238Emit event on an animation frame (asynchronously).
| name | ||
| ...args | ||
| returns | boolean | true if there were binds to trigger |
emitAsyncLock()
EventEmitter.js:257Lock the emit queue, so it is not put on animation frame until it is unlocked
emitAsyncUnlock()
EventEmitter.js:264Unlock the emit queue