Skip to content

Instantly share code, notes, and snippets.

Yassine Elouafi yelouafi

Block or report user

Report or block yelouafi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@threepointone
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 = it.next()
while(!val.done){
if(deadline.timeRemaining() <= 0){
You can’t perform that action at this time.