deno.land / x / wasm@wasmer-sdk-v0.6.0 / WasmerSDK.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
export * from "./pkg/wasmer_js";// @ts-ignoreimport load, { InitInput, InitOutput, ThreadPoolWorker, setWorkerUrl } from "./pkg/wasmer_js";
/** * Initialize the underlying WebAssembly module. */export const init = async (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput> => { if (!module_or_path) { // This will be replaced by the rollup bundler at the SDK build time // to point to a valid http location of the SDK using unpkg.com. let wasmUrl = (globalThis as any)["wasmUrl"]; if (wasmUrl) { module_or_path = new URL(wasmUrl); } } return load(module_or_path, maybe_memory);}
/** * Set a deafult working Worker Url. Which in this case will be * an unpkg url that is set up at the SDK build time. */export const setDefaultWorkerUrl = () => { let workerUrl = (globalThis as any)["workerUrl"]; if (workerUrl) { setWorkerUrl(workerUrl) }}
// HACK: We save these to the global scope because it's the most reliable way to// make sure worker.js gets access to them. Normal exports are removed when// using a bundler.(globalThis as any)["__WASMER_INTERNALS__"] = { ThreadPoolWorker, init };
// HACK: some bundlers such as webpack uses this on dev mode.// We add this functions to allow dev mode work in those bundlers.(globalThis as any).$RefreshReg$ = (globalThis as any).$RefreshReg$ || function () {/**/ };(globalThis as any).$RefreshSig$ = (globalThis as any).$RefreshSig$ || function () { return function () { } };
wasm

Version Info

Tagged at
4 months ago