You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functiondelay(x,t)// x: a function// t: delay time (ms)
constxasyncfn=require('extra-async-function');varcount=0;varfn=xasyncfn.delay(()=>++count,500);setTimeout(fn,0);setTimeout(fn,1000);// `count` incremented after 0.5s// `count` incremented after 1.5svarcount=0;varfn=xasyncfn.delay(()=>++count,500);setTimeout(fn,0);setTimeout(fn,1000);setTimeout(fn,2000);setTimeout(fn,3000);// `count` incremented after 0.5s// `count` incremented after 1.5s// `count` incremented after 2.5s// `count` incremented after 3.5s