src/event.js
// If `name` is null, removes all bound callbacks for all events.
If `name` is null, removes all bound callbacks for all events.
If ` name ` is null removes all bound callbacks for all events .
off(name, callback, context) {
        let retain,
            ev,
            events,
            names,
            i,
            l,
            j,
            k;
        if (!this._events || !eventsApi(this.event, 'off', name, [callback, context])) return this;
        if (!name && !callback && !context) {
            this._events = {};
            return this;
        }
        names = name ? [name] : Object.keys(this._events);
        for (i = 0, l = names.length; i < l; i++) {
            name = names[i];
            if (events = this._events[name]) {
                this._events[name] = retain = [];
                if (callback || context) {
                    for (j = 0, k = events.length; j < k; j++) {
                        ev = events[j];
                        if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
                            (context && context !== ev.context)) {
                            retain.push(ev);
                        }
                    }
                }
                if (!retain.length) delete this._events[name];
            }
        }
        return this;
    }
off ( name , callback , context ) { let retain , ev , events , names , i , l , j , k ; if ( ! this . _events || ! eventsApi ( this . event , 'off' , name , [ callback , context ] ) ) return this ; if ( ! name && ! callback && ! context ) { this . _events = { } ; return this ; } names = name ? [ name ] : Object . keys ( this . _events ) ; for ( i = 0 , l = names . length ; i < l ; i ++ ) { name = names [ i ] ; if ( events = this . _events [ name ] ) { this . _events [ name ] = retain = [ ] ; if ( callback || context ) { for ( j = 0 , k = events . length ; j < k ; j ++ ) { ev = events [ j ] ; if ( ( callback && callback !== ev . callback && callback !== ev . callback . _callback ) || ( context && context !== ev . context ) ) { retain . push ( ev ) ; } } } if ( ! retain . length ) delete this . _events [ name ] ; } } return this ; }
If `name` is null, removes all bound callbacks for all events.
If ` name ` is null removes all bound callbacks for all events .
// eslint-disable-next-line no-cond-assign