0.9.39 • Published 10 days ago
@halleyassist/q-lite v0.9.39
q-lite
Lightweight implementation of Q.js for performance
Methods
Q.safetyAwait
Solves stack preservation when calling async functions without an await over async boundries
function testFn(){
const deferred = Q.defer()
async function a(){
await Q.delay(1)
throw new Error('test')
}
const promise = a()
// will fail if this becomes awaited
// this is because the stack is not preserved
await Q.delay(10)
const p = Q.cancelledRace([deferred.promise,promise])
deferred.resolve()
return await p
}
Stack would be lost (testFn
) in this test over the Q.delay
call. However with Q.safetyAwait
method state can be preserved.
function testFn(){
const deferred = Q.defer()
async function a(){
await Q.delay(1)
throw new Error('test')
}
const promise = a()
// will fail if this becomes awaited
// this is because the stack is not preserved
await Q.safetyAwait([Q.delay(10)], [promise])
const p = Q.cancelledRace([deferred.promise,promise])
deferred.resolve()
return await p
}
0.9.39
10 days ago
0.9.38
14 days ago
0.9.37
15 days ago
0.9.36
17 days ago
0.9.35
3 months ago
0.9.34
4 months ago
0.9.32
4 months ago
0.9.33
4 months ago
0.9.30
8 months ago
0.9.31
6 months ago
0.9.24
8 months ago
0.9.25
8 months ago
0.9.26
8 months ago
0.9.27
8 months ago
0.9.28
8 months ago
0.9.29
8 months ago
0.9.8
1 year ago
0.9.13
1 year ago
0.9.7
1 year ago
0.9.14
1 year ago
0.9.9
1 year ago
0.9.20
1 year ago
0.9.21
1 year ago
0.9.10
1 year ago
0.9.11
1 year ago
0.9.16
1 year ago
0.9.17
1 year ago
0.9.18
1 year ago
0.9.19
1 year ago
0.9.6
2 years ago
0.9.2
2 years ago