Use analog implementation in more-proms instead.
Simple promise subclass, allowing for resolvent outside of callback (as property).
$ npm i resable-promise
Do this:
import ResablePromise from "resable-promise"
const prom = new ResablePromise()
// later...
prom.res()
So you dont have to do this:
let promRes
const prom = new Promise(res => promRes = res)
// later ...
promRes()
Only convenience, as I see myself doing this a lot. And this provides type safety without effort.
Is a promise that resolves when the base promise is ether resolved or rejected.
const prom = new ResablePromise()
prom.settled.then(() => console.log("settled"))
All feedback is appreciated. Create a pull request or write an issue.