saus
saus copied to clipboard
Investigate whether memory usage can be reduced by not caching Promise objects
My strategy would be to wrap cached promises with a new CachedPromise class.
class CachedPromise {
constructor(promise) {
this.promise = promise
promise.then((result) => {
this.result = result
this.promise = null
}, (error) => {
this.error = error
this.promise = null
})
}
then() {}
catch() {}
finally() {}
}