Hello,
Thanks for the great project, it's really useful!
I'm using it in particular context where I need to use --instantation, thanks for providing this option! My problem is that the generated instantiate function is async:
function instantiate(
compileCore: (…) => Promise<WebAssembly.Module>,
imports: ImportObject,
instantiateCore?: (…) => Promise<WebAssembly.Instance>,
): Promise<…>
I need a non-async instantiate function, such as:
function instantiate(
compileCore: (…) => WebAssembly.Module,
imports: ImportObject,
instantiateCore?: (…) => WebAssembly.Instance,
): …
I can work on this patch, but I would like to align on a couple of things beforehand:
- Are you willing to merge such a feature?
- Ideally, we want to keep
--instantiation, but I would “duplicate” the option with --instantation-no-async. Internally, we would keep the TranspileOpts::instantiation field, but a new TranspileOpts::instantiation_is_async field would be added:
--instantiation would result in TranspileOpts { instantiation: true, instantiation_is_async: true }
--instantiation-no-async would result in TranspileOpts { instantiation: true, instantiation_is_async: false }.
One could argue that I could str::replace the output of JCO to replace async function by function, await by nothing, Promise.all… by nothing and so on, but I believe this problem might appear for other users, and having this implemented inside JCO directly would be less hacky.
Thoughts?
Hello,
Thanks for the great project, it's really useful!
I'm using it in particular context where I need to use
--instantation, thanks for providing this option! My problem is that the generatedinstantiatefunction is async:I need a non-async
instantiatefunction, such as:I can work on this patch, but I would like to align on a couple of things beforehand:
--instantiation, but I would “duplicate” the option with--instantation-no-async. Internally, we would keep theTranspileOpts::instantiationfield, but a newTranspileOpts::instantiation_is_asyncfield would be added:--instantiationwould result inTranspileOpts { instantiation: true, instantiation_is_async: true }--instantiation-no-asyncwould result inTranspileOpts { instantiation: true, instantiation_is_async: false }.One could argue that I could
str::replacethe output of JCO to replaceasync functionbyfunction,awaitby nothing,Promise.all…by nothing and so on, but I believe this problem might appear for other users, and having this implemented inside JCO directly would be less hacky.Thoughts?