I have implemented my draft. It's very simple and should also work for progress. You can find the lib here yaku, and test it yourself. Here's the example:
let Promise = require('yaku')
// The `this` is the instance of the newly created promise.
let p = new Promise((resolve, reject) => {
let tmr = setTimeout(resolve, 3000)
let this.abort = () => {
clearTimeout(tmr)
reject(new Error('abort promise'))
}
})
p.abort()
I have implemented my draft. It's very simple and should also work for progress. You can find the lib here yaku, and test it yourself. Here's the example:
It's simple and flexible.