function timeout(delay, fn) { var start = now(); var data = Object.create(null); data.id = raf(loop); return data; function loop() { (now() - start) >= delay ? fn.call() : data.id = raf(loop); } }
function loop() { (now() - start) >= delay ? fn.call() : data.id = raf(loop); }