I hereby claim:
- I am lgrahl on github.
- I am lgrahl (https://keybase.io/lgrahl) on keybase.
- I have a public key whose fingerprint is 3FDB 1486 8A2B 36D6 38F3 C495 F98F BED1 0482 ABA6
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
/** | |
* A future similar to Python's asyncio.Future. Allows to resolve or reject | |
* outside of the executor. | |
*/ | |
class Future extends Promise { | |
constructor(executor) { | |
let resolve, reject; | |
super((resolve_, reject_) => { | |
resolve = resolve_; | |
reject = reject_; |
function sleep(timeout) { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
console.log('timeout!'); | |
resolve(); | |
}, timeout); | |
}); | |
} | |
class Future extends Promise { |
declare module '*?wrkr' { | |
export const url: string; | |
export const create: { | |
(): Worker; | |
}; | |
} | |
declare module '*?srvcwrkr' { | |
export const url: string; | |
export const register: { | |
( |
/** | |
* A TypeScript async lock implemented with promise chaining. | |
* | |
* Usage: | |
* | |
* this._lock.with(async () => { | |
* await doThing1(); | |
* await doThing2(a); | |
* }); | |
*/ |