index.js
function makeThrottle(fps){
    var delay = 1000/fps;
    var lastTime = Date.now();


    if( fps<=0 || fps === Infinity ){
        return returnTrue;
    }

    //if an fps throttle has been set then we'll assume
    //it natively runs at 60fps,
    var half = Math.ceil(1000 / 60) / 2;

    return function(){
        //if a custom fps is requested
        var now = Date.now();
        //is this frame within 8.5ms of the target?
        //if so then next frame is gonna be too late
        if(now - lastTime < delay - half){
            return false;
        }
        lastTime = now;
        return true;
    };
}
function makeThrottle(fps){
    var delay = 1000/fps;
    var lastTime = Date.now();


    if( fps<=0 || fps === Infinity ){
        return returnTrue;
    }

    //if an fps throttle has been set then we'll assume
    //it natively runs at 60fps,
    var half = Math.ceil(1000 / 60) / 2;

    return function(){
        //if a custom fps is requested
        var now = Date.now();
        //is this frame within 8.5ms of the target?
        //if so then next frame is gonna be too late
        if(now - lastTime < delay - half){
            return false;
        }
        lastTime = now;
        return true;
    };
}
function makeThrottle ( fps ) { var delay = 1000 / fps ; var lastTime = Date . now ( ) ; if ( fps <= 0 || fps === Infinity ) { return returnTrue ; } //if an fps throttle has been set then we'll assume //it natively runs at 60fps, var half = Math . ceil ( 1000 / 60 ) / 2 ; return function ( ) { //if a custom fps is requested var now = Date . now ( ) ; //is this frame within 8.5ms of the target? //if so then next frame is gonna be too late if ( now - lastTime < delay - half ) { return false ; } lastTime = now ; return true ; } ; }
manage FPS if < 60, else return true;
manage FPS if < 60 else return true ;