Open annevk opened 3 years ago
This just came up for me, when writing spec text for Shared Element Transitions. I have a method that accepts an async callback and returns a promise, which should resolve with the callback's returned promise.
As far as I can tell, the existing algorithm already works perfectly; we'd skip step 1 since the value isn't undefined, step 2 will convert the IDL promise into an ES promise, and then step 3 will resolve one promise with the other, which is what we want. Literally all we need to do is change the argument to the algo from
with x (a value of type
T
)
to
with x (a value of type
T
orPromise<T>
)
I think?
That sounds right.
(There might also be problems with having a JS object and treating it as an IDL object and vice versa, but that's kind of an existing problem we need to tackle at some point.)
It seems like you currently cannot resolve a promise with another one.
This came up in https://github.com/privacycg/storage-access/pull/70.