UNPKG

@alessiofrittoli/web-utils

Version:
1 lines 330 B
'use strict';var T=e=>new Promise(n=>setTimeout(n,e)),a=(e,...n)=>new Promise((r,s)=>{let t=()=>{setTimeout(async()=>{try{r(await e(...n));}catch(o){s(o);}},0);};if(typeof requestAnimationFrame!="function")return t();requestAnimationFrame(t);}),u=e=>((...n)=>a(e,...n));exports.deferCallback=u;exports.deferTask=a;exports.sleep=T;