The author here. Just opened HN and saw that my library is on the front page . If you have any questions, I can answer them.
await yieldOrContinue('user-visible');
doSomeWork();
against if (isTimeToYield('user-visible')) {
await yieldControl('user-visible');
}
doSomeWork();
A few years back when I measured it on a fast laptop the cost was ~1µs to do `await 0;`