events.js
function (eventName, fn) {
            if (typeof eventName === 'object') {
                if (eventName === null) {
                    throw "IllegalArgumentException: eventName must be a String, or an Object.";
                }

                for (var name in eventName) {
                    if (eventName.hasOwnProperty(name)) {
                        this.bind(name, eventName[name]);
                    }
                }
                return this;
            }
            
            if (!this.isSupported(eventName)) {
                throw "IllegalArgumentException: unrecognized event name (" + eventName + ").";
            }
            
            if (typeof fn !== 'function') {
                throw "IllegalArgumentException: fn must be a Function.";
            }
            
            this._events[eventName].push(fn);

            if (this.numListeners(eventName) === 1) {
                this._sendActivation('_activate', eventName);
            }
            
            return this;
        }
function (eventName, fn) {
            if (typeof eventName === 'object') {
                if (eventName === null) {
                    throw "IllegalArgumentException: eventName must be a String, or an Object.";
                }

                for (var name in eventName) {
                    if (eventName.hasOwnProperty(name)) {
                        this.bind(name, eventName[name]);
                    }
                }
                return this;
            }
            
            if (!this.isSupported(eventName)) {
                throw "IllegalArgumentException: unrecognized event name (" + eventName + ").";
            }
            
            if (typeof fn !== 'function') {
                throw "IllegalArgumentException: fn must be a Function.";
            }
            
            this._events[eventName].push(fn);

            if (this.numListeners(eventName) === 1) {
                this._sendActivation('_activate', eventName);
            }
            
            return this;
        }
function ( eventName , fn ) { if ( typeof eventName === 'object' ) { if ( eventName === null ) { throw "IllegalArgumentException: eventName must be a String, or an Object." ; } for ( var name in eventName ) { if ( eventName . hasOwnProperty ( name ) ) { this . bind ( name , eventName [ name ] ) ; } } return this ; } if ( ! this . isSupported ( eventName ) ) { throw "IllegalArgumentException: unrecognized event name (" + eventName + ")." ; } if ( typeof fn !== 'function' ) { throw "IllegalArgumentException: fn must be a Function." ; } this . _events [ eventName ] . push ( fn ) ; if ( this . numListeners ( eventName ) === 1 ) { this . _sendActivation ( '_activate' , eventName ) ; } return this ; }
Binds a listener to an event.
@param eventName {String or Object}
@param fn {Function} - Not required if 1st argument is an Object.
@returns {Events} A pointer to this instance, allowing call chaining.
Binds a listener to an event .