tc39 / proposal-dynamic-import

import() proposal for JavaScript
https://tc39.github.io/proposal-dynamic-import/
MIT License
1.86k stars 47 forks source link

[WIP] Top-level await integration #71

Closed littledan closed 3 years ago

littledan commented 5 years ago

The purpose of this patch is to nail down how dynamic import would adjust to the needs of top-level await. The relevant change is, the module.Evaluate() method will return a Promise that resolves when the module is ready, and this will be passed to FinishDynamicImport to wait on before resolving the Promise it returns.

This PR is just a sketch, not to be landed. For one, the "Upon fulfillment" language will need to be changed to be more ECMASpeak-like. Top-level await should also reach stage 3 before this change lands.

The PR where Evaluate returns a Promise is https://github.com/guybedford/proposal-top-level-await/pull/1

littledan commented 5 years ago

Twin HTML PR https://github.com/whatwg/html/pull/4352

littledan commented 5 years ago

Unnecessary with the current phrasing of https://github.com/whatwg/html/pull/4352 . (The logic is extremely trivial either way, as you can see from that patch, so I don't think there's much for us to pull back here into JS.)

littledan commented 5 years ago

Reopening, as I'm reverting that patch.

codehag commented 3 years ago

This was merged into the TLA spec, closing here

https://github.com/tc39/proposal-top-level-await/pull/148