37 lines
768 B
JavaScript
37 lines
768 B
JavaScript
// import init from 'xpin-wasm';
|
|
// import * as xpinWasm from 'xpin-wasm';
|
|
import * as xpinWasm from '$lib/pkg/xpin_wasm.js';
|
|
// import * as init from '$lib/pkg/xpin_wasm_bg.js';
|
|
// import init from '$lib/pkg/xpin_wasm_bg.wasm?init';
|
|
// import * as xpinWasm from '$lib/pkg/xpin_wasm.js';
|
|
|
|
export const WasmStatus = {
|
|
NotLoaded: -1,
|
|
Loaded: 0,
|
|
Errored: 1
|
|
};
|
|
|
|
export async function getWasm() {
|
|
let wasmStatus = WasmStatus.NotLoaded;
|
|
let wasmError;
|
|
|
|
wasmStatus = WasmStatus.Loaded;
|
|
|
|
// await init()
|
|
// .then(() => {
|
|
|
|
// })
|
|
// .catch((e) => {
|
|
// console.error('Error loading wasm module', e);
|
|
// wasmError = e;
|
|
// wasmStatus = WasmStatus.Errored;
|
|
// throw e;
|
|
// });
|
|
|
|
return {
|
|
status: wasmStatus,
|
|
error: wasmError,
|
|
call: xpinWasm
|
|
};
|
|
}
|