UNPKG

poll

Version:

A simple poll function based on async, await, and an infinite loop

2 lines (1 loc) 187 B
async function a(a,t,e=(()=>!1)){do{if(await a(),await e())break;const i="number"==typeof t?t:t();await new Promise((a=>setTimeout(a,Math.max(0,i))))}while(!await e())}export{a as poll};