A variant is a configuration object that defines how to load a QuickJS WebAssembly build and how to access the low-level C API functions required by quickjs-emscripten-core.
A variant object must include:
type: Either "sync" or "async". Use "async" if the variant is built with ASYNCIFY to allow WebAssembly execution to be suspended.importFFI: A function that resolves to a QuickJSFFI class.importModuleLoader: A function that resolves to an Emscripten-shaped WASM module factory.
You can provide custom variants to control the loading mechanism of the WebAssembly object.
const variant = {
// This should be `async` if the variant is built with ASYNCIFY
// so that the WebAssembly module execution can be suspended.
//
// Otherwise, this should be `sync`.
type: "sync",
// This should be a function that resolves to a QuickJSFFI class.
importFFI: () => import("something/ffi.ts").then((mod) => mod.QuickJSFFI),
// This should be a function that resolves to a Emscripten-shaped WASM module factory.
importModuleLoader: () => import("something/emscripten-module.ts"),
}