You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposal currently depends on the fact that changing import() is backwards compatible. However if it proves not to be I would like to propose an alternative that delegates the un-thening to the producer rather than the consumer.
The proposal is very simple: just add a an internal slot to promise instances [[OriginalResolveValue]] that is the value that was originally passed into resolve. Then we could have a single static function on Promise, e.g. Promise.originalValue that returns a new promise that boxes the [[OriginalResolveValue]].
It should not be possible to do this unless the promise has explicitly opted in; i can think of all sorts of security issues/encapsulation violations that would occur. If it can’t be done on the producing end it probably shouldn’t be done.
This proposal currently depends on the fact that changing
import()
is backwards compatible. However if it proves not to be I would like to propose an alternative that delegates the un-thening to the producer rather than the consumer.The proposal is very simple: just add a an internal slot to promise instances
[[OriginalResolveValue]]
that is the value that was originally passed intoresolve
. Then we could have a single static function onPromise
, e.g.Promise.originalValue
that returns a new promise that boxes the[[OriginalResolveValue]]
.e.g.:
The main downside is that
.then()
would still be invoked but this means it wouldn't be a breaking change for existing code.The text was updated successfully, but these errors were encountered: