on()

in lib/@uncharted/cards/src/util/IBindable.js [46:64]


    on(events, callback) {
        if (events === null) {
            if (this.mOmniHandlers.indexOf(callback) < 0) {
                this.mOmniHandlers.push(callback);
            }
        } else {
            const eventArray = events instanceof Array ? events : events.split(' ');
            eventArray.forEach(event => {
                let handlers = this.mHandlers[event];
                if (!handlers) {
                    handlers = [];
                    this.mHandlers[event] = handlers;
                }
                if (handlers.indexOf(callback) < 0) {
                    handlers.push(callback);
                }
            });
        }
    }