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

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

            // If no type is given, remove all handlers
            if (!type) {
                return delete this._events;
            }

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

            // If no handler is given, remove all handlers for this type
            if (!handler) {
                return delete this._events[type];
            }

            // Do we have a matching handler?
            var handlers = this._events[type];
            var i = arrayIndexOf(handlers, handler);
            if (i === -1) {
                return;
            }

            // Remove handler
            handlers.splice(i, 1);

        }
function (type, handler) {

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

            // If no type is given, remove all handlers
            if (!type) {
                return delete this._events;
            }

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

            // If no handler is given, remove all handlers for this type
            if (!handler) {
                return delete this._events[type];
            }

            // Do we have a matching handler?
            var handlers = this._events[type];
            var i = arrayIndexOf(handlers, handler);
            if (i === -1) {
                return;
            }

            // Remove handler
            handlers.splice(i, 1);

        }
function ( type , handler ) { // Validate arguments if ( typeof type !== 'undefined' && typeof type !== 'string' ) { throw new Error ( 'Type must be a string or undefined' ) ; } if ( typeof handler !== 'undefined' && typeof handler !== 'function' ) { throw new Error ( 'Handler must be a function or undefined' ) ; } // If no type is given, remove all handlers if ( ! type ) { return delete this . _events ; } // Check for presence of event store if ( ! this . _events || ! this . _events [ type ] ) { return ; } // If no handler is given, remove all handlers for this type if ( ! handler ) { return delete this . _events [ type ] ; } // Do we have a matching handler? var handlers = this . _events [ type ] ; var i = arrayIndexOf ( handlers , handler ) ; if ( i === - 1 ) { return ; } // Remove handler handlers . splice ( i , 1 ) ; }
Unbind handlers from events
Unbind handlers from events