-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathp-timeout.node.txt
23 lines (17 loc) · 1.15 KB
/
p-timeout.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
┏━━━━━━━━━━━━━━━┓
┃ P-TIMEOUT ┃
┗━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See delay
VERSION ==> #6.1.4
P-TIMEOUT(PROMISE, OPTS)->PROMISE2#Calls OPTS.fallback() after OPTS.milliseconds ms (required) (using setTimeout())
#If PROMISE.cancel() is defined, fire it (see p-cancelable doc)
PROMISE2.clear() #clearTimeout()
OPTS.signal #ABORT_SIGNAL. On abort, reject PROMISE2, but does not call OPTS.fallback() nor PROMISE.cancel()
OPTS.fallback #Def: reject PROMISE2
OPTS.message #ERROR|'ERROR' rejecting PROMISE2
#Def: TimeoutError with 'Promise timed out after NUM milliseconds'
#Can also be false, to resolve PROMISE2 instead
OPTS.customTimers.
setTimeout|clearTimeout #Custom FUNC
TimeoutError #
TIMEOUT_ERROR.name #'TimeoutError'