avi
03/28/2023, 11:23 PMkian
03/28/2023, 11:23 PMkian
03/28/2023, 11:23 PMavi
03/28/2023, 11:23 PMavi
03/28/2023, 11:23 PMkian
03/28/2023, 11:23 PMkian
03/28/2023, 11:23 PMavi
03/28/2023, 11:24 PMkian
03/28/2023, 11:24 PMkian
03/28/2023, 11:25 PMawait scheduler.wait(ms)
or what Walshy posted, just keep in mind that the timer that backs those timeouts is Spectre-safe so it won't really wait that many milliseconds, but it should be close.Walshy | Pages
03/28/2023, 11:25 PMkian
03/28/2023, 11:25 PMDate.now()
, fetch(..., { signal: AbortSignal.timeout(1000) })
, Date.now()
will give you a delta of 1000 - but it isn't really 1000ms of wall-clock time, but it should be close enough for your use-cases imokian
03/28/2023, 11:25 PMavi
03/28/2023, 11:26 PMavi
03/28/2023, 11:26 PMavi
03/28/2023, 11:27 PMkian
03/28/2023, 11:27 PMawait scheduler.wait(1); Date.now()
is good enough for youavi
03/28/2023, 11:27 PM--local
but not in --experimental-local
?kian
03/28/2023, 11:28 PM--local
is likely just a discrepancy between development and production since --local
is a Node emulation whereas --experimental-local
uses the open-source runtimeavi
03/28/2023, 11:28 PMnode_compat = true
right?Walshy | Pages
03/28/2023, 11:28 PMkian
03/28/2023, 11:29 PMkian
03/28/2023, 11:29 PMcompatibility_flags = ["nodejs_compat"]
is better ones built into the runtime - but there aren't very many modules covered by it just yetavi
03/28/2023, 11:29 PMkian
03/28/2023, 11:29 PMavi
03/28/2023, 11:29 PMscheduler.wait()
Walshy | Pages
03/28/2023, 11:29 PMkian
03/28/2023, 11:29 PMkian
03/28/2023, 11:30 PMglobalThis
- the only things that need importing is the Node polyfills if you use those