Index

mixinEventEmitter

MMO.core · 1 symbol · generated 5 Oct 2026

mixin

mixinEventEmitter

EventEmitter.js:15
class MMO.core.mixinEventEmitter extends extendClass
Namespace
MMO.core
Extends
extendClass

Index

eventNames readonly accessorNOTE: 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) generatorYield 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) asyncAsync 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:49

NOTE: only the string names. A Symbol event is not enumerated by Object.keys.

get eventNames()
Type
Array<string>

Methods14

onFind(name, listener, scope)

EventEmitter.js:23

Find listener.

onFind(name, listener, scope = false)
namestringthe event's name
listenerFunction | nullif null will look for listener with the right scope
scope = falsefalse | null | Objectif != false, look for listener with the right scope
returnsnull | MMO.core.Binding

onExists(name)

EventEmitter.js:41
onExists(name)
namestring | Symbol
returnsboolean | numberfalsy when the event carries no listener

eventBindings(name)

EventEmitter.js:58

The live list of bindings registered for an event. Do not mutate it: use off/offScope.

eventBindings(name)
namestring | Symbol
returnsArray<MMO.core.EventBinding>empty when nothing is registered

loopEventsByScope(scope)

generatorEventEmitter.js:67

Yield all events concerning a given scope

*loopEventsByScope(scope)
scopeobjectthe scope to look for in EventBinding

on(name, listener, scope, last)

EventEmitter.js:86

Add a listener

on(name, listener, scope = null, last = true)
namestring | Symbol
listenerFunction | MMO.core.EventBinding
scope = nullnull | Objectthe scope to call the listener with (ignore when listener is an EventBinding)
last = trueBooleanif false, set the listener as head of listeners chain
returnsMMO.core.EventBinding

once(name, listener, scope, last)

EventEmitter.js:109

Add a listener for one time

once(name, listener, scope = null, last = true)
namestring | Symbol
listenerFunction
scope = nullnull | Objectthe scope to call the listener with
last = trueBooleanif false, unshift the listener instead of push
returnsMMO.core.EventBinding

onWait(event, resolvedValue, last)

asyncEventEmitter.js:121

Async on

async onWait(event, resolvedValue = undefined, last = true)
eventstring | Symbol
resolvedValue = undefined
last = trueBooleanif false, unshift the listener instead of push
returnsvoid

off(name, listener, scope)

EventEmitter.js:134

Remove listener

off(name, listener, scope = false)
namestring | Symbolthe event's name
listenerFunction | MMO.core.EventBinding | nullif null will look for binding with the right scope
scope = falsefalse | null | Objectif != false, look for binding with the right scope
returnsMMO.core.EventBinding | null

offScope(scope)

EventEmitter.js:168

Remove all listeners of a given scope

offScope(scope)
scopeObject
returnsvoid

offAll()

EventEmitter.js:178

Drop every listener of every event at once.

offAll()NOTE: unlike `off`, this does NOT cancel the changes already queued for delivery.

emit(name, args)

EventEmitter.js:191

Emit an event

emit(name, ...args)
namestring | Symbol
...args...the arguments to pass to the listeners
returnsintthe number of listener called

emitAsync(name, args)

EventEmitter.js:238

Emit event on an animation frame (asynchronously).

emitAsync(name, ...args)If an EventBinding is already registered in the queue and is registered again with the same arguments, it is ignored.
name
...args
returnsbooleantrue if there were binds to trigger

emitAsyncLock()

EventEmitter.js:257

Lock the emit queue, so it is not put on animation frame until it is unlocked

emitAsyncLock()