Re: [whatwg/webidl] Promises: resolve algorithm should accept a promise (#957)

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` or `Promise<T>`)

I think?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/957#issuecomment-1147719126
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/957/1147719126@github.com>

Received on Monday, 6 June 2022 17:50:43 UTC