Compare commits

...

1 Commits

Author SHA1 Message Date
24f53983d7 fix: switch buttplug WASM to --target web for browser compatibility
Some checks failed
Build and Push Backend Image / build (push) Successful in 47s
Build and Push Buttplug Image / build (push) Has been cancelled
Build and Push Frontend Image / build (push) Has been cancelled
--target bundler generates static WASM ESM imports that only work
through a bundler (vite-plugin-wasm). --target web generates fetch-based
WASM loading via import.meta.url which browsers handle natively.

- Change wasm-pack build target from bundler to web
- Call wasmModule.default() (init) after import in maybeLoadWasm
- Restore rollupOptions.external so WASM stays a separate fetch
- Removes the need for vite-plugin-wasm in any consumer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 14:07:14 +01:00
10 changed files with 3108 additions and 2 deletions

1394
packages/buttplug/dist/index.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
], ],
"scripts": { "scripts": {
"build": "vite build", "build": "vite build",
"build:wasm": "wasm-pack build --out-dir wasm --out-name index --target bundler --release", "build:wasm": "wasm-pack build --out-dir wasm --out-name index --target web --release",
"serve": "node serve.mjs" "serve": "node serve.mjs"
}, },
"dependencies": { "dependencies": {

View File

@@ -40,7 +40,9 @@ export class ButtplugWasmClientConnector extends EventEmitter implements IButtpl
private static maybeLoadWasm = async () => { private static maybeLoadWasm = async () => {
if (ButtplugWasmClientConnector.wasmInstance == undefined) { if (ButtplugWasmClientConnector.wasmInstance == undefined) {
ButtplugWasmClientConnector.wasmInstance = await import("../wasm/index.js"); const wasmModule = await import("../wasm/index.js");
await wasmModule.default(); // --target web requires calling init() before using exports
ButtplugWasmClientConnector.wasmInstance = wasmModule;
} }
}; };

1
packages/buttplug/wasm/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*

64
packages/buttplug/wasm/index.d.ts vendored Normal file
View File

@@ -0,0 +1,64 @@
/* tslint:disable */
/* eslint-disable */
export function buttplug_activate_env_logger(_max_level: string): void;
export function buttplug_client_send_json_message(server_ptr: number, buf: Uint8Array, callback: Function): void;
export function buttplug_create_embedded_wasm_server(callback: Function): number;
export function buttplug_free_embedded_wasm_server(ptr: number): void;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly create_test_dcm: (a: number, b: number) => void;
readonly buttplug_activate_env_logger: (a: number, b: number) => void;
readonly buttplug_client_send_json_message: (a: number, b: number, c: number, d: any) => void;
readonly buttplug_create_embedded_wasm_server: (a: any) => number;
readonly buttplug_free_embedded_wasm_server: (a: number) => void;
readonly wasm_bindgen__closure__destroy__h72b504abf7ea70fd: (a: number, b: number) => void;
readonly wasm_bindgen__closure__destroy__ha3c8e2c9b0cf79cd: (a: number, b: number) => void;
readonly wasm_bindgen__closure__destroy__h0f95d90d24796def: (a: number, b: number) => void;
readonly wasm_bindgen__convert__closures_____invoke__hcd253b168dd40e38: (a: number, b: number, c: any) => [number, number];
readonly wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1: (a: number, b: number, c: any) => [number, number];
readonly wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_3: (a: number, b: number, c: any) => [number, number];
readonly wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_4: (a: number, b: number, c: any) => [number, number];
readonly wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_5: (a: number, b: number, c: any) => [number, number];
readonly wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_6: (a: number, b: number, c: any) => [number, number];
readonly wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_9: (a: number, b: number, c: any) => [number, number];
readonly wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243: (a: number, b: number, c: any) => void;
readonly wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243_8: (a: number, b: number, c: any) => void;
readonly wasm_bindgen__convert__closures_____invoke__h20343c2d1e7cb4cd: (a: number, b: number) => void;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __externref_table_alloc: () => number;
readonly __wbindgen_externrefs: WebAssembly.Table;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __externref_table_dealloc: (a: number) => void;
readonly __wbindgen_start: () => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;

View File

@@ -0,0 +1,814 @@
/* @ts-self-types="./index.d.ts" */
/**
* @param {string} _max_level
*/
export function buttplug_activate_env_logger(_max_level) {
const ptr0 = passStringToWasm0(_max_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.buttplug_activate_env_logger(ptr0, len0);
}
/**
* @param {number} server_ptr
* @param {Uint8Array} buf
* @param {Function} callback
*/
export function buttplug_client_send_json_message(server_ptr, buf, callback) {
const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.buttplug_client_send_json_message(server_ptr, ptr0, len0, callback);
}
/**
* @param {Function} callback
* @returns {number}
*/
export function buttplug_create_embedded_wasm_server(callback) {
const ret = wasm.buttplug_create_embedded_wasm_server(callback);
return ret >>> 0;
}
/**
* @param {number} ptr
*/
export function buttplug_free_embedded_wasm_server(ptr) {
wasm.buttplug_free_embedded_wasm_server(ptr);
}
function __wbg_get_imports() {
const import0 = {
__proto__: null,
__wbg___wbindgen_debug_string_a1b3fd0656850da8: function(arg0, arg1) {
const ret = debugString(arg1);
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
},
__wbg___wbindgen_is_function_82aa5b8e9371b250: function(arg0) {
const ret = typeof(arg0) === 'function';
return ret;
},
__wbg___wbindgen_is_object_61452b678ecf7ecf: function(arg0) {
const val = arg0;
const ret = typeof(val) === 'object' && val !== null;
return ret;
},
__wbg___wbindgen_is_string_91960b7ba9d4d76b: function(arg0) {
const ret = typeof(arg0) === 'string';
return ret;
},
__wbg___wbindgen_is_undefined_7b12045c262a3121: function(arg0) {
const ret = arg0 === undefined;
return ret;
},
__wbg___wbindgen_throw_83ebd457a191bc2a: function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
},
__wbg__wbg_cb_unref_4fc42a417bb095f4: function(arg0) {
arg0._wbg_cb_unref();
},
__wbg_bluetooth_5967024a158f671e: function(arg0) {
const ret = arg0.bluetooth;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_buffer_bfae6dde33a7e5a0: function(arg0) {
const ret = arg0.buffer;
return ret;
},
__wbg_byteLength_5fbecf2b9f6cc625: function(arg0) {
const ret = arg0.byteLength;
return ret;
},
__wbg_call_72a54043615c73e3: function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.call(arg1, arg2);
return ret;
}, arguments); },
__wbg_connect_61050e3a8e3f5f1c: function(arg0) {
const ret = arg0.connect();
return ret;
},
__wbg_crypto_38df2bab126b63dc: function(arg0) {
const ret = arg0.crypto;
return ret;
},
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.error(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
},
__wbg_gatt_aeca65a254a75f07: function(arg0) {
const ret = arg0.gatt;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_getCharacteristic_4daa5211272f941c: function(arg0, arg1, arg2) {
const ret = arg0.getCharacteristic(getStringFromWasm0(arg1, arg2));
return ret;
},
__wbg_getPrimaryService_8b6197119664f448: function(arg0, arg1, arg2) {
const ret = arg0.getPrimaryService(getStringFromWasm0(arg1, arg2));
return ret;
},
__wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
}, arguments); },
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
arg0.getRandomValues(arg1);
}, arguments); },
__wbg_getRandomValues_ef8a9e8b447216e2: function() { return handleError(function (arg0, arg1) {
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
}, arguments); },
__wbg_get_bda2de250e7f67d3: function() { return handleError(function (arg0, arg1) {
const ret = Reflect.get(arg0, arg1);
return ret;
}, arguments); },
__wbg_id_c3a9ae039584e9f6: function(arg0, arg1) {
const ret = arg1.id;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
},
__wbg_instanceof_Window_3bc43738919f4587: function(arg0) {
let result;
try {
result = arg0 instanceof Window;
} catch (_) {
result = false;
}
const ret = result;
return ret;
},
__wbg_length_684e7f4ac265724c: function(arg0) {
const ret = arg0.length;
return ret;
},
__wbg_log_0c201ade58bb55e1: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
},
__wbg_log_ce2c4456b290c5e7: function(arg0, arg1) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.log(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
},
__wbg_mark_b4d943f3bc2d2404: function(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
},
__wbg_measure_84362959e621a2c1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
let deferred0_0;
let deferred0_1;
let deferred1_0;
let deferred1_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
deferred1_0 = arg2;
deferred1_1 = arg3;
performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
}
}, arguments); },
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
const ret = arg0.msCrypto;
return ret;
},
__wbg_name_0a4944b9b89a9be1: function(arg0, arg1) {
const ret = arg1.name;
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
},
__wbg_navigator_91b141c3f3b6b96b: function(arg0) {
const ret = arg0.navigator;
return ret;
},
__wbg_new_18cda2e4779f118c: function(arg0) {
const ret = new Uint8Array(arg0);
return ret;
},
__wbg_new_227d7c05414eb861: function() {
const ret = new Error();
return ret;
},
__wbg_new_5c365a7570baea64: function() {
const ret = new Object();
return ret;
},
__wbg_new_with_byte_offset_ba99c41da925551a: function(arg0, arg1) {
const ret = new Uint8Array(arg0, arg1 >>> 0);
return ret;
},
__wbg_new_with_length_875a3f1ab82a1a1f: function(arg0) {
const ret = new Uint8Array(arg0 >>> 0);
return ret;
},
__wbg_node_84ea875411254db1: function(arg0) {
const ret = arg0.node;
return ret;
},
__wbg_now_55c5352b4b61d145: function(arg0) {
const ret = arg0.now();
return ret;
},
__wbg_now_7627eff456aa5959: function(arg0) {
const ret = arg0.now();
return ret;
},
__wbg_performance_aa4d78060a5b8a2f: function(arg0) {
const ret = arg0.performance;
return ret;
},
__wbg_process_44c7a14e11e9f69e: function(arg0) {
const ret = arg0.process;
return ret;
},
__wbg_prototypesetcall_7c3092bff32833dc: function(arg0, arg1, arg2) {
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
},
__wbg_queueMicrotask_17a58d631cc9ab4b: function(arg0) {
queueMicrotask(arg0);
},
__wbg_queueMicrotask_4114767fcf2790b9: function(arg0) {
const ret = arg0.queueMicrotask;
return ret;
},
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
arg0.randomFillSync(arg1);
}, arguments); },
__wbg_readValue_c83601164f2a0105: function(arg0) {
const ret = arg0.readValue();
return ret;
},
__wbg_requestDevice_26b08548120ca1d9: function(arg0, arg1) {
const ret = arg0.requestDevice(arg1);
return ret;
},
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
const ret = module.require;
return ret;
}, arguments); },
__wbg_resolve_67a1b1ca24efbc5c: function(arg0) {
const ret = Promise.resolve(arg0);
return ret;
},
__wbg_setTimeout_05a790c35d76ff25: function() { return handleError(function (arg0, arg1, arg2) {
const ret = arg0.setTimeout(arg1, arg2);
return ret;
}, arguments); },
__wbg_set_filters_7e7f78143ddef831: function(arg0, arg1, arg2) {
arg0.filters = getArrayJsValueViewFromWasm0(arg1, arg2);
},
__wbg_set_name_be5429dc123f1dd9: function(arg0, arg1, arg2) {
arg0.name = getStringFromWasm0(arg1, arg2);
},
__wbg_set_name_prefix_41b281c72726c519: function(arg0, arg1, arg2) {
arg0.namePrefix = getStringFromWasm0(arg1, arg2);
},
__wbg_set_oncharacteristicvaluechanged_d54b71ecfbe76b96: function(arg0, arg1) {
arg0.oncharacteristicvaluechanged = arg1;
},
__wbg_set_ongattserverdisconnected_960815a2e872d5a0: function(arg0, arg1) {
arg0.ongattserverdisconnected = arg1;
},
__wbg_set_optional_services_e183aa24417dc7cb: function(arg0, arg1, arg2) {
arg0.optionalServices = getArrayJsValueViewFromWasm0(arg1, arg2);
},
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
const ret = arg1.stack;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
},
__wbg_startNotifications_acc2fc1198e7dd6f: function(arg0) {
const ret = arg0.startNotifications();
return ret;
},
__wbg_static_accessor_GLOBAL_833a66cb4996dbd8: function() {
const ret = typeof global === 'undefined' ? null : global;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_static_accessor_GLOBAL_THIS_fc74cdbdccd80770: function() {
const ret = typeof globalThis === 'undefined' ? null : globalThis;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_static_accessor_SELF_066699022f35d48b: function() {
const ret = typeof self === 'undefined' ? null : self;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_static_accessor_WINDOW_f821c7eb05393790: function() {
const ret = typeof window === 'undefined' ? null : window;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_subarray_22ac454570db4e4f: function(arg0, arg1, arg2) {
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
return ret;
},
__wbg_target_188bf8368fa5f001: function(arg0) {
const ret = arg0.target;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_then_420f698ab0b99678: function(arg0, arg1) {
const ret = arg0.then(arg1);
return ret;
},
__wbg_then_95c29fbd346ee84e: function(arg0, arg1, arg2) {
const ret = arg0.then(arg1, arg2);
return ret;
},
__wbg_value_d1ef9362b7bf7a47: function(arg0) {
const ret = arg0.value;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
},
__wbg_versions_276b2795b1c6a219: function(arg0) {
const ret = arg0.versions;
return ret;
},
__wbg_writeValue_99570c64ee612498: function() { return handleError(function (arg0, arg1) {
const ret = arg0.writeValue(arg1);
return ret;
}, arguments); },
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 3402, function: Function { arguments: [Externref], shim_idx: 3403, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h72b504abf7ea70fd, wasm_bindgen__convert__closures_____invoke__hcd253b168dd40e38);
return ret;
},
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 3413, function: Function { arguments: [], shim_idx: 3414, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__ha3c8e2c9b0cf79cd, wasm_bindgen__convert__closures_____invoke__h20343c2d1e7cb4cd);
return ret;
},
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("BluetoothDevice")], shim_idx: 81, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1);
return ret;
},
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("BluetoothRemoteGATTCharacteristic")], shim_idx: 81, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_3);
return ret;
},
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("BluetoothRemoteGATTServer")], shim_idx: 81, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_4);
return ret;
},
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("BluetoothRemoteGATTService")], shim_idx: 81, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_5);
return ret;
},
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("DataView")], shim_idx: 81, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_6);
return ret;
},
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("Event")], shim_idx: 86, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243);
return ret;
},
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 86, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243_8);
return ret;
},
__wbindgen_cast_000000000000000a: function(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 80, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 81, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f95d90d24796def, wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_9);
return ret;
},
__wbindgen_cast_000000000000000b: function(arg0, arg1) {
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
const ret = getArrayU8FromWasm0(arg0, arg1);
return ret;
},
__wbindgen_cast_000000000000000c: function(arg0, arg1) {
// Cast intrinsic for `Ref(String) -> Externref`.
const ret = getStringFromWasm0(arg0, arg1);
return ret;
},
__wbindgen_init_externref_table: function() {
const table = wasm.__wbindgen_externrefs;
const offset = table.grow(4);
table.set(0, undefined);
table.set(offset + 0, undefined);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
},
};
return {
__proto__: null,
"./index_bg.js": import0,
};
}
function wasm_bindgen__convert__closures_____invoke__h20343c2d1e7cb4cd(arg0, arg1) {
wasm.wasm_bindgen__convert__closures_____invoke__h20343c2d1e7cb4cd(arg0, arg1);
}
function wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243(arg0, arg1, arg2) {
wasm.wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243(arg0, arg1, arg2);
}
function wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243_8(arg0, arg1, arg2) {
wasm.wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243_8(arg0, arg1, arg2);
}
function wasm_bindgen__convert__closures_____invoke__hcd253b168dd40e38(arg0, arg1, arg2) {
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hcd253b168dd40e38(arg0, arg1, arg2);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
function wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1(arg0, arg1, arg2) {
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1(arg0, arg1, arg2);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
function wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_3(arg0, arg1, arg2) {
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_3(arg0, arg1, arg2);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
function wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_4(arg0, arg1, arg2) {
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_4(arg0, arg1, arg2);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
function wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_5(arg0, arg1, arg2) {
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_5(arg0, arg1, arg2);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
function wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_6(arg0, arg1, arg2) {
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_6(arg0, arg1, arg2);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
function wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_9(arg0, arg1, arg2) {
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_9(arg0, arg1, arg2);
if (ret[1]) {
throw takeFromExternrefTable0(ret[0]);
}
}
function addToExternrefTable0(obj) {
const idx = wasm.__externref_table_alloc();
wasm.__wbindgen_externrefs.set(idx, obj);
return idx;
}
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches && builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
function getArrayJsValueViewFromWasm0(ptr, len) {
ptr = ptr >>> 0;
const mem = getDataViewMemory0();
const result = [];
for (let i = ptr; i < ptr + 4 * len; i += 4) {
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
}
return result;
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
}
return cachedDataViewMemory0;
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return decodeText(ptr, len);
}
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
const idx = addToExternrefTable0(e);
wasm.__wbindgen_exn_store(idx);
}
}
function isLikeNone(x) {
return x === undefined || x === null;
}
function makeMutClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
const a = state.a;
state.a = 0;
try {
return f(a, state.b, ...args);
} finally {
state.a = a;
real._wbg_cb_unref();
}
};
real._wbg_cb_unref = () => {
if (--state.cnt === 0) {
state.dtor(state.a, state.b);
state.a = 0;
CLOSURE_DTORS.unregister(state);
}
};
CLOSURE_DTORS.register(real, state, state);
return real;
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8ArrayMemory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7F) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = cachedTextEncoder.encodeInto(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
function takeFromExternrefTable0(idx) {
const value = wasm.__wbindgen_externrefs.get(idx);
wasm.__externref_table_dealloc(idx);
return value;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
const MAX_SAFARI_DECODE_BYTES = 2146435072;
let numBytesDecoded = 0;
function decodeText(ptr, len) {
numBytesDecoded += len;
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
numBytesDecoded = len;
}
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
const cachedTextEncoder = new TextEncoder();
if (!('encodeInto' in cachedTextEncoder)) {
cachedTextEncoder.encodeInto = function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length
};
};
}
let WASM_VECTOR_LEN = 0;
let wasmModule, wasm;
function __wbg_finalize_init(instance, module) {
wasm = instance.exports;
wasmModule = module;
cachedDataViewMemory0 = null;
cachedUint8ArrayMemory0 = null;
wasm.__wbindgen_start();
return wasm;
}
async function __wbg_load(module, imports) {
if (typeof Response === 'function' && module instanceof Response) {
if (typeof WebAssembly.instantiateStreaming === 'function') {
try {
return await WebAssembly.instantiateStreaming(module, imports);
} catch (e) {
const validResponse = module.ok && expectedResponseType(module.type);
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
} else { throw e; }
}
}
const bytes = await module.arrayBuffer();
return await WebAssembly.instantiate(bytes, imports);
} else {
const instance = await WebAssembly.instantiate(module, imports);
if (instance instanceof WebAssembly.Instance) {
return { instance, module };
} else {
return instance;
}
}
function expectedResponseType(type) {
switch (type) {
case 'basic': case 'cors': case 'default': return true;
}
return false;
}
}
function initSync(module) {
if (wasm !== undefined) return wasm;
if (module !== undefined) {
if (Object.getPrototypeOf(module) === Object.prototype) {
({module} = module)
} else {
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
}
}
const imports = __wbg_get_imports();
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
}
const instance = new WebAssembly.Instance(module, imports);
return __wbg_finalize_init(instance, module);
}
async function __wbg_init(module_or_path) {
if (wasm !== undefined) return wasm;
if (module_or_path !== undefined) {
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
({module_or_path} = module_or_path)
} else {
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
}
}
if (module_or_path === undefined) {
module_or_path = new URL('index_bg.wasm', import.meta.url);
}
const imports = __wbg_get_imports();
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
module_or_path = fetch(module_or_path);
}
const { instance, module } = await __wbg_load(await module_or_path, imports);
return __wbg_finalize_init(instance, module);
}
export { initSync, __wbg_init as default };

View File

@@ -0,0 +1,770 @@
let wasm;
export function __wbg_set_wasm(val) {
wasm = val;
}
function isLikeNone(x) {
return x === undefined || x === null;
}
function addToExternrefTable0(obj) {
const idx = wasm.__externref_table_alloc();
wasm.__wbindgen_export_1.set(idx, obj);
return idx;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
const idx = addToExternrefTable0(e);
wasm.__wbindgen_exn_store(idx);
}
}
let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
}
return cachedUint8ArrayMemory0;
}
const lTextDecoder =
typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
let cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
const MAX_SAFARI_DECODE_BYTES = 2146435072;
let numBytesDecoded = 0;
function decodeText(ptr, len) {
numBytesDecoded += len;
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
numBytesDecoded = len;
}
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}
function getStringFromWasm0(ptr, len) {
ptr = ptr >>> 0;
return decodeText(ptr, len);
}
function getArrayU8FromWasm0(ptr, len) {
ptr = ptr >>> 0;
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}
let WASM_VECTOR_LEN = 0;
const lTextEncoder =
typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
const cachedTextEncoder = new lTextEncoder("utf-8");
const encodeString =
typeof cachedTextEncoder.encodeInto === "function"
? function (arg, view) {
return cachedTextEncoder.encodeInto(arg, view);
}
: function (arg, view) {
const buf = cachedTextEncoder.encode(arg);
view.set(buf);
return {
read: arg.length,
written: buf.length,
};
};
function passStringToWasm0(arg, malloc, realloc) {
if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0;
getUint8ArrayMemory0()
.subarray(ptr, ptr + buf.length)
.set(buf);
WASM_VECTOR_LEN = buf.length;
return ptr;
}
let len = arg.length;
let ptr = malloc(len, 1) >>> 0;
const mem = getUint8ArrayMemory0();
let offset = 0;
for (; offset < len; offset++) {
const code = arg.charCodeAt(offset);
if (code > 0x7f) break;
mem[ptr + offset] = code;
}
if (offset !== len) {
if (offset !== 0) {
arg = arg.slice(offset);
}
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view);
offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0;
}
WASM_VECTOR_LEN = offset;
return ptr;
}
let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
if (
cachedDataViewMemory0 === null ||
cachedDataViewMemory0.buffer.detached === true ||
(cachedDataViewMemory0.buffer.detached === undefined &&
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
) {
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
}
return cachedDataViewMemory0;
}
function debugString(val) {
// primitive types
const type = typeof val;
if (type == "number" || type == "boolean" || val == null) {
return `${val}`;
}
if (type == "string") {
return `"${val}"`;
}
if (type == "symbol") {
const description = val.description;
if (description == null) {
return "Symbol";
} else {
return `Symbol(${description})`;
}
}
if (type == "function") {
const name = val.name;
if (typeof name == "string" && name.length > 0) {
return `Function(${name})`;
} else {
return "Function";
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = "[";
if (length > 0) {
debug += debugString(val[0]);
}
for (let i = 1; i < length; i++) {
debug += ", " + debugString(val[i]);
}
debug += "]";
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches && builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == "Object") {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return "Object(" + JSON.stringify(val) + ")";
} catch (_) {
return "Object";
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
const CLOSURE_DTORS =
typeof FinalizationRegistry === "undefined"
? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry((state) => {
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
});
function makeMutClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
const a = state.a;
state.a = 0;
try {
return f(a, state.b, ...args);
} finally {
if (--state.cnt === 0) {
wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
CLOSURE_DTORS.unregister(state);
} else {
state.a = a;
}
}
};
real.original = state;
CLOSURE_DTORS.register(real, state, state);
return real;
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1, 1) >>> 0;
getUint8ArrayMemory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
/**
* @param {number} server_ptr
* @param {Uint8Array} buf
* @param {Function} callback
*/
export function buttplug_client_send_json_message(server_ptr, buf, callback) {
const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
const len0 = WASM_VECTOR_LEN;
wasm.buttplug_client_send_json_message(server_ptr, ptr0, len0, callback);
}
/**
* @param {number} ptr
*/
export function buttplug_free_embedded_wasm_server(ptr) {
wasm.buttplug_free_embedded_wasm_server(ptr);
}
/**
* @param {string} _max_level
*/
export function buttplug_activate_env_logger(_max_level) {
const ptr0 = passStringToWasm0(_max_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.buttplug_activate_env_logger(ptr0, len0);
}
/**
* @param {Function} callback
* @returns {number}
*/
export function buttplug_create_embedded_wasm_server(callback) {
const ret = wasm.buttplug_create_embedded_wasm_server(callback);
return ret >>> 0;
}
function __wbg_adapter_8(arg0, arg1, arg2) {
wasm.closure3251_externref_shim(arg0, arg1, arg2);
}
function __wbg_adapter_11(arg0, arg1, arg2) {
wasm.closure202_externref_shim(arg0, arg1, arg2);
}
function __wbg_adapter_16(arg0, arg1) {
wasm.wasm_bindgen__convert__closures_____invoke__h239e120689ecd2a1(arg0, arg1);
}
export function __wbg_bluetooth_b95c3b6935c8a51a(arg0) {
const ret = arg0.bluetooth;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_buffer_068eb5b0fbad96d8(arg0) {
const ret = arg0.buffer;
return ret;
}
export function __wbg_byteLength_59ab6482fa6cb38b(arg0) {
const ret = arg0.byteLength;
return ret;
}
export function __wbg_call_2f8d426a20a307fe() {
return handleError(function (arg0, arg1) {
const ret = arg0.call(arg1);
return ret;
}, arguments);
}
export function __wbg_call_f53f0647ceb9c567() {
return handleError(function (arg0, arg1, arg2) {
const ret = arg0.call(arg1, arg2);
return ret;
}, arguments);
}
export function __wbg_connect_b91d2ba90a1ff675(arg0) {
const ret = arg0.connect();
return ret;
}
export function __wbg_crypto_86f2631e91b51511(arg0) {
const ret = arg0.crypto;
return ret;
}
export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.error(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
}
export function __wbg_gatt_06b2bdb9e7f8fb84(arg0) {
const ret = arg0.gatt;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_getCharacteristic_1cb1de10f54aa049(arg0, arg1, arg2) {
const ret = arg0.getCharacteristic(getStringFromWasm0(arg1, arg2));
return ret;
}
export function __wbg_getPrimaryService_f8c0b8be4fded7fd(arg0, arg1, arg2) {
const ret = arg0.getPrimaryService(getStringFromWasm0(arg1, arg2));
return ret;
}
export function __wbg_getRandomValues_1c61fac11405ffdc() {
return handleError(function (arg0, arg1) {
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
}, arguments);
}
export function __wbg_getRandomValues_9c5c1b115e142bb8() {
return handleError(function (arg0, arg1) {
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
}, arguments);
}
export function __wbg_getRandomValues_b3f15fcbfabb0f8b() {
return handleError(function (arg0, arg1) {
arg0.getRandomValues(arg1);
}, arguments);
}
export function __wbg_get_27b4bcbec57323ca() {
return handleError(function (arg0, arg1) {
const ret = Reflect.get(arg0, arg1);
return ret;
}, arguments);
}
export function __wbg_id_d769eab9a0939b42(arg0, arg1) {
const ret = arg1.id;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
}
export function __wbg_instanceof_Window_7f29e5c72acbfd60(arg0) {
let result;
try {
result = arg0 instanceof Window;
} catch (_) {
result = false;
}
const ret = result;
return ret;
}
export function __wbg_length_904c0910ed998bf3(arg0) {
const ret = arg0.length;
return ret;
}
export function __wbg_log_0cc1b7768397bcfe(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.log(
getStringFromWasm0(arg0, arg1),
getStringFromWasm0(arg2, arg3),
getStringFromWasm0(arg4, arg5),
getStringFromWasm0(arg6, arg7),
);
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
}
export function __wbg_log_cb9e190acc5753fb(arg0, arg1) {
let deferred0_0;
let deferred0_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
console.log(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
}
}
export function __wbg_mark_7438147ce31e9d4b(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
}
export function __wbg_measure_fb7825c11612c823() {
return handleError(function (arg0, arg1, arg2, arg3) {
let deferred0_0;
let deferred0_1;
let deferred1_0;
let deferred1_1;
try {
deferred0_0 = arg0;
deferred0_1 = arg1;
deferred1_0 = arg2;
deferred1_1 = arg3;
performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
} finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
}
}, arguments);
}
export function __wbg_msCrypto_d562bbe83e0d4b91(arg0) {
const ret = arg0.msCrypto;
return ret;
}
export function __wbg_name_cf5d973f5e1d9b1e(arg0, arg1) {
const ret = arg1.name;
var ptr1 = isLikeNone(ret)
? 0
: passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
}
export function __wbg_navigator_b6d1cae68d750613(arg0) {
const ret = arg0.navigator;
return ret;
}
export function __wbg_new_1930cbb8d9ffc31b() {
const ret = new Object();
return ret;
}
export function __wbg_new_8a6f238a6ece86ea() {
const ret = new Error();
return ret;
}
export function __wbg_new_9190433fb67ed635(arg0) {
const ret = new Uint8Array(arg0);
return ret;
}
export function __wbg_new_e969dc3f68d25093() {
const ret = [];
return ret;
}
export function __wbg_newnoargs_a81330f6e05d8aca(arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return ret;
}
export function __wbg_newwithbyteoffset_b204dc995f2352f4(arg0, arg1) {
const ret = new Uint8Array(arg0, arg1 >>> 0);
return ret;
}
export function __wbg_newwithlength_ed0ee6c1edca86fc(arg0) {
const ret = new Uint8Array(arg0 >>> 0);
return ret;
}
export function __wbg_node_e1f24f89a7336c2e(arg0) {
const ret = arg0.node;
return ret;
}
export function __wbg_now_0dc4920a47cf7280(arg0) {
const ret = arg0.now();
return ret;
}
export function __wbg_now_1f875e5cd673bc3c(arg0) {
const ret = arg0.now();
return ret;
}
export function __wbg_performance_6adc3b899e448a23(arg0) {
const ret = arg0.performance;
return ret;
}
export function __wbg_process_3975fd6c72f520aa(arg0) {
const ret = arg0.process;
return ret;
}
export function __wbg_prototypesetcall_c5f74efd31aea86b(arg0, arg1, arg2) {
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
}
export function __wbg_push_cd3ac7d5b094565d(arg0, arg1) {
const ret = arg0.push(arg1);
return ret;
}
export function __wbg_queueMicrotask_bcc6e26d899696db(arg0) {
const ret = arg0.queueMicrotask;
return ret;
}
export function __wbg_queueMicrotask_f24a794d09c42640(arg0) {
queueMicrotask(arg0);
}
export function __wbg_randomFillSync_f8c153b79f285817() {
return handleError(function (arg0, arg1) {
arg0.randomFillSync(arg1);
}, arguments);
}
export function __wbg_readValue_9d41d1a73a07165f(arg0) {
const ret = arg0.readValue();
return ret;
}
export function __wbg_requestDevice_17840c36162ed342(arg0, arg1) {
const ret = arg0.requestDevice(arg1);
return ret;
}
export function __wbg_require_b74f47fc2d022fd6() {
return handleError(function () {
const ret = module.require;
return ret;
}, arguments);
}
export function __wbg_resolve_5775c0ef9222f556(arg0) {
const ret = Promise.resolve(arg0);
return ret;
}
export function __wbg_setTimeout_63008613644b07af() {
return handleError(function (arg0, arg1, arg2) {
const ret = arg0.setTimeout(arg1, arg2);
return ret;
}, arguments);
}
export function __wbg_setfilters_b142ba75a84ace1a(arg0, arg1) {
arg0.filters = arg1;
}
export function __wbg_setname_decc08ea308195a6(arg0, arg1, arg2) {
arg0.name = getStringFromWasm0(arg1, arg2);
}
export function __wbg_setnameprefix_3c1f973506cd8f08(arg0, arg1, arg2) {
arg0.namePrefix = getStringFromWasm0(arg1, arg2);
}
export function __wbg_setoncharacteristicvaluechanged_a126981aa4e69da5(arg0, arg1) {
arg0.oncharacteristicvaluechanged = arg1;
}
export function __wbg_setongattserverdisconnected_d43d7f3a48a58fa4(arg0, arg1) {
arg0.ongattserverdisconnected = arg1;
}
export function __wbg_setoptionalservices_b6c19589e7aa503e(arg0, arg1) {
arg0.optionalServices = arg1;
}
export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
const ret = arg1.stack;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
}
export function __wbg_startNotifications_e1edb2183f9289f5(arg0) {
const ret = arg0.startNotifications();
return ret;
}
export function __wbg_static_accessor_GLOBAL_1f13249cc3acc96d() {
const ret = typeof global === "undefined" ? null : global;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_static_accessor_GLOBAL_THIS_df7ae94b1e0ed6a3() {
const ret = typeof globalThis === "undefined" ? null : globalThis;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_static_accessor_SELF_6265471db3b3c228() {
const ret = typeof self === "undefined" ? null : self;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_static_accessor_WINDOW_16fb482f8ec52863() {
const ret = typeof window === "undefined" ? null : window;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_subarray_a219824899e59712(arg0, arg1, arg2) {
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
return ret;
}
export function __wbg_target_bfb4281bfa013115(arg0) {
const ret = arg0.target;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_then_8d2fcccde5380a03(arg0, arg1, arg2) {
const ret = arg0.then(arg1, arg2);
return ret;
}
export function __wbg_then_9cc266be2bf537b6(arg0, arg1) {
const ret = arg0.then(arg1);
return ret;
}
export function __wbg_value_5e240e44f81872c5(arg0) {
const ret = arg0.value;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}
export function __wbg_versions_4e31226f5e8dc909(arg0) {
const ret = arg0.versions;
return ret;
}
export function __wbg_wbindgencbdrop_a85ed476c6a370b9(arg0) {
const obj = arg0.original;
if (obj.cnt-- == 1) {
obj.a = 0;
return true;
}
const ret = false;
return ret;
}
export function __wbg_wbindgendebugstring_bb652b1bc2061b6d(arg0, arg1) {
const ret = debugString(arg1);
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
}
export function __wbg_wbindgenisfunction_ea72b9d66a0e1705(arg0) {
const ret = typeof arg0 === "function";
return ret;
}
export function __wbg_wbindgenisobject_dfe064a121d87553(arg0) {
const val = arg0;
const ret = typeof val === "object" && val !== null;
return ret;
}
export function __wbg_wbindgenisstring_4b74e4111ba029e6(arg0) {
const ret = typeof arg0 === "string";
return ret;
}
export function __wbg_wbindgenisundefined_71f08a6ade4354e7(arg0) {
const ret = arg0 === undefined;
return ret;
}
export function __wbg_wbindgenthrow_4c11a24fca429ccf(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
}
export function __wbg_writeValue_586734e0fc6e7c73() {
return handleError(function (arg0, arg1) {
const ret = arg0.writeValue(arg1);
return ret;
}, arguments);
}
export function __wbindgen_cast_0f76fca626397b3d(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 201, function: Function { arguments: [NamedExternref("Event")], shim_idx: 202, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_11);
return ret;
}
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
// Cast intrinsic for `Ref(String) -> Externref`.
const ret = getStringFromWasm0(arg0, arg1);
return ret;
}
export function __wbindgen_cast_30a893855537e77b(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 201, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 202, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, 201, __wbg_adapter_11);
return ret;
}
export function __wbindgen_cast_76c05e7c8d82d9b7(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 3269, function: Function { arguments: [], shim_idx: 3270, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, 3269, __wbg_adapter_16);
return ret;
}
export function __wbindgen_cast_cb3d47e2c086b274(arg0, arg1) {
// Cast intrinsic for `Closure(Closure { dtor_idx: 3250, function: Function { arguments: [Externref], shim_idx: 3251, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
const ret = makeMutClosure(arg0, arg1, 3250, __wbg_adapter_8);
return ret;
}
export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
const ret = getArrayU8FromWasm0(arg0, arg1);
return ret;
}
export function __wbindgen_init_externref_table() {
const table = wasm.__wbindgen_export_1;
const offset = table.grow(4);
table.set(0, undefined);
table.set(offset + 0, undefined);
table.set(offset + 1, null);
table.set(offset + 2, true);
table.set(offset + 3, false);
}

Binary file not shown.

View File

@@ -0,0 +1,29 @@
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export const create_test_dcm: (a: number, b: number) => void;
export const buttplug_activate_env_logger: (a: number, b: number) => void;
export const buttplug_client_send_json_message: (a: number, b: number, c: number, d: any) => void;
export const buttplug_create_embedded_wasm_server: (a: any) => number;
export const buttplug_free_embedded_wasm_server: (a: number) => void;
export const wasm_bindgen__closure__destroy__h72b504abf7ea70fd: (a: number, b: number) => void;
export const wasm_bindgen__closure__destroy__ha3c8e2c9b0cf79cd: (a: number, b: number) => void;
export const wasm_bindgen__closure__destroy__h0f95d90d24796def: (a: number, b: number) => void;
export const wasm_bindgen__convert__closures_____invoke__hcd253b168dd40e38: (a: number, b: number, c: any) => [number, number];
export const wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1: (a: number, b: number, c: any) => [number, number];
export const wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_3: (a: number, b: number, c: any) => [number, number];
export const wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_4: (a: number, b: number, c: any) => [number, number];
export const wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_5: (a: number, b: number, c: any) => [number, number];
export const wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_6: (a: number, b: number, c: any) => [number, number];
export const wasm_bindgen__convert__closures_____invoke__h0628356d4885b6d1_9: (a: number, b: number, c: any) => [number, number];
export const wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243: (a: number, b: number, c: any) => void;
export const wasm_bindgen__convert__closures_____invoke__h996ec8878d3e4243_8: (a: number, b: number, c: any) => void;
export const wasm_bindgen__convert__closures_____invoke__h20343c2d1e7cb4cd: (a: number, b: number) => void;
export const __wbindgen_malloc: (a: number, b: number) => number;
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
export const __externref_table_alloc: () => number;
export const __wbindgen_externrefs: WebAssembly.Table;
export const __wbindgen_exn_store: (a: number) => void;
export const __wbindgen_free: (a: number, b: number, c: number) => void;
export const __externref_table_dealloc: (a: number) => void;
export const __wbindgen_start: () => void;

View File

@@ -0,0 +1,32 @@
{
"name": "buttplug_wasm",
"type": "module",
"collaborators": [
"Nonpolynomial Labs, LLC <kyle@nonpolynomial.com>"
],
"description": "WASM Interop for the Buttplug Intimate Hardware Control Library",
"version": "10.0.0",
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "https://github.com/buttplugio/buttplug.git"
},
"files": [
"index_bg.wasm",
"index.js",
"index.d.ts"
],
"main": "index.js",
"homepage": "http://buttplug.io",
"types": "index.d.ts",
"sideEffects": [
"./snippets/*"
],
"keywords": [
"usb",
"serial",
"hardware",
"bluetooth",
"teledildonics"
]
}