lib/chic-event.js
function (type, handler) {

            // Validate arguments
            if (typeof type !== 'string') {
                throw new Error('Type must be a string');
            }
            if (typeof handler !== 'function') {
                throw new Error('Handler must be a function');
            }

            // Check for presence of event store
            if (!this._events) {
                this._events = {};
            }
            if (!this._events[type]) {
                this._events[type] = [];
            }

            // Add handler
            this._events[type].push(handler);

        }
function (type, handler) {

            // Validate arguments
            if (typeof type !== 'string') {
                throw new Error('Type must be a string');
            }
            if (typeof handler !== 'function') {
                throw new Error('Handler must be a function');
            }

            // Check for presence of event store
            if (!this._events) {
                this._events = {};
            }
            if (!this._events[type]) {
                this._events[type] = [];
            }

            // Add handler
            this._events[type].push(handler);

        }
function ( type , handler ) { // Validate arguments if ( typeof type !== 'string' ) { throw new Error ( 'Type must be a string' ) ; } if ( typeof handler !== 'function' ) { throw new Error ( 'Handler must be a function' ) ; } // Check for presence of event store if ( ! this . _events ) { this . _events = { } ; } if ( ! this . _events [ type ] ) { this . _events [ type ] = [ ] ; } // Add handler this . _events [ type ] . push ( handler ) ; }
Bind a handler to an event
Bind a handler to an event