endo icon indicating copy to clipboard operation
endo copied to clipboard

Compartment support for top-level await

Open kriskowal opened this issue 5 years ago • 3 comments

ESM does or will soon have support for await at the top-level of a module’s scope. To support this feature, when we choose to support this feature, will require a refactor of the transform-module and module-instance components to surface a new calling convention. importNow will still return a namespace without wrapping in a promise, but will throw if the module has not run to completion. Modules will await the completion of all their shallow imports before executing.

kriskowal avatar May 12 '20 01:05 kriskowal

Will this feature be implemented?

GulgDev avatar Feb 29 '24 07:02 GulgDev

This is not on our roadmap but we would entertain help if it’s needed. Just above this link you can find ways to get in touch with us https://github.com/endojs/endo?tab=readme-ov-file#ruminations-on-the-name

kriskowal avatar Feb 29 '24 22:02 kriskowal

I think it's not that hard to implement. StaticModuleRecord could wrap code in an async function, and import could await precompiled function before returning.

GulgDev avatar Mar 02 '24 08:03 GulgDev