This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* NEVER BLOCKING LOOP : implementation of the infamous setTimeout 0 hack, with time checking in order to guarantee fluidity without sacrificing execution speed. | |
* | |
* USAGE : | |
* var array = ["a way too big array that is heavy to process"] | |
* optimizeFor({ | |
* nbIterations: array.length, | |
* each:function( index ) { | |
* doSomethingUsefulWith( array[ index ] ); | |
* }, |