js/modules/events.js
/**
     * Adds a handler that gets called when the named event is dispatched.
     * @param {string} name - Name of the event this handler responds to.
     * @param {function} handler - Handler that takes the event data.
     */
Adds a handler that gets called when the named event is dispatched.
@param {string} name - Name of the event this handler responds to.
@param {function} handler - Handler that takes the event data.
Adds a handler that gets called when the named event is dispatched . @param { string } name - Name of the event this handler responds to . @param { function } handler - Handler that takes the event data .
addHandler(name, handler) {
        this.pendingHandlers.push({
            'name': name,
            'handler': handler
        })
        if (!this.workingOnHandlers) {
            this.workingOnHandlers = true
            while (true) {
                var newHandler = this.pendingHandlers.shift()
                if (newHandler === undefined) {
                    break
                }
                var currentHandlers = this.handlers[name]
                if (currentHandlers === undefined) {
                    currentHandlers = []
                }
                currentHandlers.push(handler)
                this.handlers[name] = currentHandlers
            }
            this.workingOnHandlers = false
        }
    }
addHandler ( name , handler ) { this . pendingHandlers . push ( { 'name' : name , 'handler' : handler } ) if ( ! this . workingOnHandlers ) { this . workingOnHandlers = true while ( true ) { var newHandler = this . pendingHandlers . shift ( ) if ( newHandler === undefined ) { break } var currentHandlers = this . handlers [ name ] if ( currentHandlers === undefined ) { currentHandlers = [ ] } currentHandlers . push ( handler ) this . handlers [ name ] = currentHandlers } this . workingOnHandlers = false } }
Adds a handler that gets called when the named event is dispatched.
Adds a handler that gets called when the named event is dispatched .