lib/prototypes/events.js
function onDelayed(delay, throttle, eventNames, selector, listener) {
    if (typeof throttle !== 'boolean') {
        listener = selector;
        selector = eventNames;
        eventNames = throttle;
        throttle = false;
    }

    if (typeof selector === 'function') {
        listener = selector;
        selector = undefined;
    }

    var wait = undefined;
    this.on(eventNames, selector, /** @function 
                                  * @param {...*} args */function () {
        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
        }

        var _this = this;

        if (!throttle) {
            clearTimeout(wait);
            wait = null;
        }

        if (!wait) {
            wait = setTimeout(function () {
                wait = null;
                listener.apply(_this, args);
            }, delay);
        }
    });
}
function onDelayed(delay, throttle, eventNames, selector, listener) {
    if (typeof throttle !== 'boolean') {
        listener = selector;
        selector = eventNames;
        eventNames = throttle;
        throttle = false;
    }

    if (typeof selector === 'function') {
        listener = selector;
        selector = undefined;
    }

    var wait = undefined;
    this.on(eventNames, selector, /** @function 
                                  * @param {...*} args */function () {
        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
        }

        var _this = this;

        if (!throttle) {
            clearTimeout(wait);
            wait = null;
        }

        if (!wait) {
            wait = setTimeout(function () {
                wait = null;
                listener.apply(_this, args);
            }, delay);
        }
    });
}
function onDelayed ( delay , throttle , eventNames , selector , listener ) { if ( typeof throttle !== 'boolean' ) { listener = selector ; selector = eventNames ; eventNames = throttle ; throttle = false ; } if ( typeof selector === 'function' ) { listener = selector ; selector = undefined ; } var wait = undefined ; this . on ( eventNames , selector , /** @function 
                                  * @param {...*} args */ function ( ) { for ( var _len = arguments . length , args = Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) { args [ _key ] = arguments [ _key ] ; } var _this = this ; if ( ! throttle ) { clearTimeout ( wait ) ; wait = null ; } if ( ! wait ) { wait = setTimeout ( function ( ) { wait = null ; listener . apply ( _this , args ) ; } , delay ) ; } } ) ; }
Register a delayed listener for a space separated list of events

Usefull for key typing events

@example <caption>Example usage of onDelayed.</caption>
$('#input-search').onDelayed(200, 'keyup', (event) => {
console.log(event.$element.getValue()
}

@method Element#onDelayed
@param  {Number} delay
@param  {String} eventNames
@param  {String=} selector
@param  {Function} listener
 
Register a delayed listener for a space separated list of events

Usefull for key typing events

@example <caption>Example usage of onDelayed.</caption>
$('#input-search').onDelayed(200, 'keyup', (event) => {
console.log(event.$element.getValue()
}

@method ElementsArray#onDelayed
@param  {Number} delay
@param  {Number} [throttle=false]
@param  {String} eventNames
@param  {String} [selector]
@param  {Function} listener
Register a delayed listener for a space separated list of events