Summary
A JS function passed into wasm — as a callback argument, or nested inside a foreign's
result — cannot currently be marshalled into a callable wasm closure. Only direction 1 (a
wasm closure handed out to JS) is implemented.
Status / evidence
- The import-direction marshaller throws explicitly:
bin/src/Main.purs:465 —
"marshalling a JS function into wasm is not yet supported (ADR 0014, closure direction 2)".
- ADR 0014 defers this: it needs a JS-side function registry + a host-import trampoline so
wasm can hold and re-enter a JS callable.
Direction
Per ADR 0014: register JS callables and expose a host-import trampoline; have eqrefFromJs
wrap a JS function as a wasm closure that calls back through it.
Summary
A JS function passed into wasm — as a callback argument, or nested inside a foreign's
result — cannot currently be marshalled into a callable wasm closure. Only direction 1 (a
wasm closure handed out to JS) is implemented.
Status / evidence
bin/src/Main.purs:465—"marshalling a JS function into wasm is not yet supported (ADR 0014, closure direction 2)".
wasm can hold and re-enter a JS callable.
Direction
Per ADR 0014: register JS callables and expose a host-import trampoline; have
eqrefFromJswrap a JS function as a wasm closure that calls back through it.