riloadr.js
/*
     * Thanks to underscore.js and lodash.js
     * Returns a function, that, as long as it continues to be invoked, will not
     * be triggered. The function will be called after it stops being called for
     * N milliseconds. If `immediate` is passed, trigger the function on the
     * leading edge, instead of the trailing.
     */
Thanks to underscore.js and lodash.js
Returns a function, that, as long as it continues to be invoked, will not
be triggered. The function will be called after it stops being called for
N milliseconds. If `immediate` is passed, trigger the function on the
leading edge, instead of the trailing.
Thanks to underscore . js and lodash . js Returns a function that as long as it continues to be invoked will not be triggered . The function will be called after it stops being called for N milliseconds . If ` immediate ` is passed trigger the function on the leading edge instead of the trailing .
function debounce(func, wait, immediate) {
        var args
          , result
          , thisArg
          , timeoutId;
        function delayed() {
            timeoutId = NULL;
            if (!immediate) {
                func[APPLY](thisArg, args);
            }
        }
        return function() {
            var isImmediate = immediate && !timeoutId;
            args = arguments;
            thisArg = this;
            clearTimeout(timeoutId);
            timeoutId = delay(delayed, wait);
            if (isImmediate) {
                result = func[APPLY](thisArg, args);
            }
            return result;
        };
    }
function debounce ( func , wait , immediate ) { var args , result , thisArg , timeoutId ; function delayed ( ) { timeoutId = NULL ; if ( ! immediate ) { func [ APPLY ] ( thisArg , args ) ; } } return function ( ) { var isImmediate = immediate && ! timeoutId ; args = arguments ; thisArg = this ; clearTimeout ( timeoutId ) ; timeoutId = delay ( delayed , wait ) ; if ( isImmediate ) { result = func [ APPLY ] ( thisArg , args ) ; } return result ; } ; }
Thanks to underscore.js and lodash.js
 Returns a function, that, as long as it continues to be invoked, will not
 be triggered.
Thanks to underscore . js and lodash . js Returns a function that as long as it continues to be invoked will not be triggered .