This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23143 - Add an "adopt" hook for Promises
Summary: Add an "adopt" hook for Promises
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-03 21:50 UTC by Tab Atkins Jr.
Modified: 2013-09-06 15:03 UTC (History)
3 users (show)

See Also:


Attachments

Description Tab Atkins Jr. 2013-09-03 21:50:28 UTC
The Promises spec currently has API hooks for fulfilling and rejecting a promise.  It should also have a hook for adopting a promise.

Use-case: I'm returning a promise from an operation in the Font Load Events API.  Sometimes it'll be rejected quickly and directly, so I need to have a handle for the promise itself.  If all goes well, though, the result should be as if Promise.every() was called on a spec-defined list of other promises, which requires me to have the original returned promise adopt the result of the Promise.every() algorithm (once it's defined in a spec fashion that can be safely invoked).
Comment 1 Domenic Denicola 2013-09-03 21:59:13 UTC
From what I understand, this is asking for `Resolve`. https://github.com/domenic/promises-unwrapping#resolvep-x
Comment 2 Anne 2013-09-04 09:07:19 UTC
Also an internal hook to Promise.every() that cannot be overridden I suspect. Similar to how XMLHttpRequest wants that for JSON.parse().
Comment 3 Anne 2013-09-06 15:03:17 UTC
Tab, I recommend chiming in here: https://github.com/domenic/promises-unwrapping/issues/21