MCPcopy Create free account
hub / github.com/ceifa/wasmoon / constructor

Method constructor

src/factory.ts:18–30  ·  view source on GitHub ↗

* Constructs a new LuaFactory instance. * @param [customWasmUri] - Custom URI for the Lua WebAssembly module. * @param [environmentVariables] - Environment variables for the Lua engine.

(customWasmUri?: string, environmentVariables?: EnvironmentVariables)

Source from the content-addressed store, hash-verified

16 * @param [environmentVariables] - Environment variables for the Lua engine.
17 */
18 public constructor(customWasmUri?: string, environmentVariables?: EnvironmentVariables) {
19 if (customWasmUri === undefined) {
20 const isBrowser =
21 (typeof window === 'object' && typeof window.document !== 'undefined') ||
22 (typeof self === 'object' && self?.constructor?.name === 'DedicatedWorkerGlobalScope')
23
24 if (isBrowser) {
25 customWasmUri = `https://unpkg.com/wasmoon@${version}/dist/glue.wasm`
26 }
27 }
28
29 this.luaWasmPromise = LuaWasm.initialize(customWasmUri, environmentVariables)
30 }
31
32 /**
33 * Mounts a file in the Lua environment asynchronously.

Callers

nothing calls this directly

Calls 1

initializeMethod · 0.80

Tested by

no test coverage detected