Skip to content

Instantly share code, notes, and snippets.


Yassine Elouafi yelouafi

View GitHub Profile
threepointone / gen-ric.js
Created Dec 23, 2016
generators + requestIdleCallback
View gen-ric.js
// 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 =
if(deadline.timeRemaining() <= 0){