riloadr.js
/*
     * Thanks to underscore.js and lodash.js
     * Returns a function, that, when invoked, will only be triggered at most once
     * during a given window of time.
     */
Thanks to underscore.js and lodash.js
Returns a function, that, when invoked, will only be triggered at most once
during a given window of time.
Thanks to underscore . js and lodash . js Returns a function that when invoked will only be triggered at most once during a given window of time .
function throttle(func, wait) {
        var args
          , result
          , thisArg
          , timeoutId
          , lastCalled = 0;
        function trailingCall() {
            lastCalled = new Date;
            timeoutId = NULL;
            func[APPLY](thisArg, args);
        }
        return function() {
            var now = new Date
              , remain = wait - (now - lastCalled);
            args = arguments;
            thisArg = this;
            if (remain <= 0) {
                lastCalled = now;
                result = func[APPLY](thisArg, args);
            } else if (!timeoutId) {
                timeoutId = delay(trailingCall, remain);
            }
            return result;
        };
    }
function throttle ( func , wait ) { var args , result , thisArg , timeoutId , lastCalled = 0 ; function trailingCall ( ) { lastCalled = new Date ; timeoutId = NULL ; func [ APPLY ] ( thisArg , args ) ; } return function ( ) { var now = new Date , remain = wait - ( now - lastCalled ) ; args = arguments ; thisArg = this ; if ( remain <= 0 ) { lastCalled = now ; result = func [ APPLY ] ( thisArg , args ) ; } else if ( ! timeoutId ) { timeoutId = delay ( trailingCall , remain ) ; } return result ; } ; }
Thanks to underscore.js and lodash.js
 Returns a function, that, when invoked, will only be triggered at most once
 during a given window of time.
Thanks to underscore . js and lodash . js Returns a function that when invoked will only be triggered at most once during a given window of time .