|
|
|
|
|
by _benton
340 days ago
|
|
You can also schedule code to run each "tick" of the event loop, which is a non-blocking version of a while loop. Or you could promisify the send function and use normal async/await. let q = Promise.resolve(),
sendAsync = (p) => new Promise(r => send(p, r)),
sendOnce = (p, c, ms) => setTimeout(_ => q.then(_ => sendAsync(p)).then(c), ms)
Or you could actually spin up a new worker thread and get multithreading :P |
|