-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdelay.node.txt
24 lines (18 loc) · 1.36 KB
/
delay.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
┏━━━━━━━━━━━┓
┃ DELAY ┃
┗━━━━━━━━━━━┛
ALTERNATIVES ==> # - require('timers/promises').setTimeout() (preferred if Node.js only)
# - delay (preferred if need browser support, or only wait for time)
# - AbortSignal.timeout() (preferred if timeout a specific function)
# - p-timeout (preferred if timeout a specific function, and cannot use AbortSignal)
VERSION ==> #6.0.0
DELAY(NUM[, OPTS])->PROMISE #Resolve PROMISE after NUMms
#OPTS:
# - value VAL (def: undefined): resolved value
# - signal ABORT_SIGNAL: reject PROMISE with AbortError (message 'Delay aborted') when ABORT_SIGNAL is aborted
clearDelay(PROMISE) #clearTimeout() and resolve PROMISE
rangeDelay(NUM, NUM2[, OPTS])
->PROMISE #Same but using random integer from NUM to NUM2 (both included)
createDelay(OBJ)->DELAY #Customize OBJ.setTimeout|clearTimeout(...)
delay NUM #CLI. NUM is in seconds
#Version 2.0.0