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
// this is a generic runner for iterators | |
// for every yield, it checks to see if any time is remaining | |
// on the idle loop, and executes more work if so. | |
// else, it queues up for the next idle period | |
function go(it, callback){ | |
requestIdleCallback(deadline => { | |
let val = it.next() | |
while(!val.done){ | |
if(deadline.timeRemaining() <= 0){ |