feature-request/question: Possibility of a version without top-level-await? #121
-
Hello, I was wondering if a browser-version was possible, which did not rely on top-level-await to be imported. I am trying to use this package inside of an existing angular 19 project,. I have seen other wasm-projects which are importable without relying on top-level-await like 7z-wasm I cannot make a judgement on the merits of using top-level-await and exporting individual classes and methods as opposed to exporting a Promise from which you then access all classes and methods available. I would be happy for information on the pros, cons and barriers of both approaches. my rough proposal: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I’m not very familiar with Angular, but top-level-await is a runtime feature that has been supported by all major browsers for quite some time. The main reasons for using top-level await are:
The issue with a design like 7z-asm is that each time you call and await moduleLoader, it creates a new WASM instance. While an app using libxml2-wasm directly might be fine, problems can arise if multiple libraries use this pattern, as it leads to multiple isolated WASM instances without shared data, causing integration issues. Which module system is your Angular app using?
|
Beta Was this translation helpful? Give feedback.
I’m not very familiar with Angular, but top-level-await is a runtime feature that has been supported by all major browsers for quite some time.
The main reasons for using top-level await are:
The issue with a design like 7z-asm is that each time you call and await moduleLoader, it creates a new WASM instance. While an app using libxml2-wasm directly might be fine, problems can arise if…