[heycam/webidl] Allow functions to be used as promise inputs (#1020)

See https://github.com/WICG/app-history/issues/40 for background.

Basically, any time we convert an ES value to a `Promise<T>`, we should first check to see if it's a function. If so, we should call the function, and use its return value.

This allows code such as

```js
event.waitUntil((async () => {
  // ...
})());
```

to become

```js
event.waitUntil(async () => {
  // ...
});
```

This would be backward-compatible since there is no existing instances of `Promise<T>` where `T` is a callback function type, that are used as inputs.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/1020

Received on Tuesday, 7 September 2021 19:21:33 UTC