buttplug-wasm
Advanced tools
Comparing version 1.0.0-beta3 to 1.0.0-beta4
@@ -7,2 +7,12 @@ /* tslint:disable */ | ||
/** | ||
*/ | ||
export enum ButtplugErrorType { | ||
ConnectorError, | ||
HandshakeError, | ||
DeviceError, | ||
MessageError, | ||
PingError, | ||
UnknownError, | ||
} | ||
/** | ||
* Used in [MessageAttributes][crate::core::messages::MessageAttributes] for denoting message | ||
@@ -88,16 +98,4 @@ * capabilties. | ||
/** | ||
* @param {string} client_name | ||
* @param {ButtplugEmbeddedConnectorOptions} options | ||
* @returns {Promise<any>} | ||
*/ | ||
static connect_embedded(client_name: string, options: ButtplugEmbeddedConnectorOptions): Promise<any>; | ||
/** | ||
* @param {string} client_name | ||
* @param {ButtplugWebsocketConnectorOptions} options | ||
* @returns {Promise<any>} | ||
*/ | ||
static connect_websocket(client_name: string, options: ButtplugWebsocketConnectorOptions): Promise<any>; | ||
/** | ||
* @returns {Promise<any>} | ||
*/ | ||
disconnect(): Promise<any>; | ||
@@ -199,2 +197,6 @@ /** | ||
/** | ||
* @returns {Promise<any>} | ||
*/ | ||
stop(): Promise<any>; | ||
/** | ||
* @param {number} message_type | ||
@@ -252,2 +254,15 @@ * @returns {any} | ||
*/ | ||
export class ButtplugError { | ||
free(): void; | ||
/** | ||
* @returns {number} | ||
*/ | ||
error_type: number; | ||
/** | ||
* @returns {string} | ||
*/ | ||
reason: string; | ||
} | ||
/** | ||
*/ | ||
export class ButtplugWebsocketConnectorOptions { | ||
@@ -254,0 +269,0 @@ free(): void; |
@@ -7,2 +7,12 @@ /* tslint:disable */ | ||
/** | ||
*/ | ||
export enum ButtplugErrorType { | ||
ConnectorError, | ||
HandshakeError, | ||
DeviceError, | ||
MessageError, | ||
PingError, | ||
UnknownError, | ||
} | ||
/** | ||
* Used in [MessageAttributes][crate::core::messages::MessageAttributes] for denoting message | ||
@@ -88,16 +98,4 @@ * capabilties. | ||
/** | ||
* @param {string} client_name | ||
* @param {ButtplugEmbeddedConnectorOptions} options | ||
* @returns {Promise<any>} | ||
*/ | ||
static connect_embedded(client_name: string, options: ButtplugEmbeddedConnectorOptions): Promise<any>; | ||
/** | ||
* @param {string} client_name | ||
* @param {ButtplugWebsocketConnectorOptions} options | ||
* @returns {Promise<any>} | ||
*/ | ||
static connect_websocket(client_name: string, options: ButtplugWebsocketConnectorOptions): Promise<any>; | ||
/** | ||
* @returns {Promise<any>} | ||
*/ | ||
disconnect(): Promise<any>; | ||
@@ -199,2 +197,6 @@ /** | ||
/** | ||
* @returns {Promise<any>} | ||
*/ | ||
stop(): Promise<any>; | ||
/** | ||
* @param {number} message_type | ||
@@ -252,2 +254,15 @@ * @returns {any} | ||
*/ | ||
export class ButtplugError { | ||
free(): void; | ||
/** | ||
* @returns {number} | ||
*/ | ||
error_type: number; | ||
/** | ||
* @returns {string} | ||
*/ | ||
reason: string; | ||
} | ||
/** | ||
*/ | ||
export class ButtplugWebsocketConnectorOptions { | ||
@@ -268,2 +283,3 @@ free(): void; | ||
readonly memory: WebAssembly.Memory; | ||
readonly start: () => void; | ||
readonly __wbg_buttplugembeddedconnectoroptions_free: (a: number) => void; | ||
@@ -288,4 +304,2 @@ readonly buttplugembeddedconnectoroptions_new: () => number; | ||
readonly buttplugclient_connect: (a: number, b: number, c: number) => number; | ||
readonly buttplugclient_connect_embedded: (a: number, b: number, c: number) => number; | ||
readonly buttplugclient_connect_websocket: (a: number, b: number, c: number) => number; | ||
readonly buttplugclient_disconnect: (a: number) => number; | ||
@@ -298,3 +312,7 @@ readonly buttplugclient_addListener: (a: number, b: number, c: number) => void; | ||
readonly buttplugclient_stopAllDevices: (a: number) => number; | ||
readonly start: () => void; | ||
readonly __wbg_buttplugerror_free: (a: number) => void; | ||
readonly __wbg_get_buttplugerror_error_type: (a: number) => number; | ||
readonly __wbg_set_buttplugerror_error_type: (a: number, b: number) => void; | ||
readonly buttplugerror_reason: (a: number, b: number) => void; | ||
readonly buttplugerror_set_reason: (a: number, b: number, c: number) => void; | ||
readonly __wbg_buttplugclientdevice_free: (a: number) => void; | ||
@@ -314,2 +332,3 @@ readonly buttplugclientdevice_name: (a: number, b: number) => void; | ||
readonly buttplugclientdevice_rawUnsubscribe: (a: number, b: number) => number; | ||
readonly buttplugclientdevice_stop: (a: number) => number; | ||
readonly buttplugclientdevice_allowed_messages_getter: (a: number) => number; | ||
@@ -316,0 +335,0 @@ readonly buttplugclientdevice_messageAttributes: (a: number, b: number) => number; |
@@ -225,2 +225,8 @@ | ||
/** | ||
*/ | ||
export function start() { | ||
wasm.start(); | ||
} | ||
const u32CvtShim = new Uint32Array(2); | ||
@@ -238,14 +244,2 @@ | ||
function _assertClass(instance, klass) { | ||
if (!(instance instanceof klass)) { | ||
throw new Error(`expected instance of ${klass.name}`); | ||
} | ||
return instance.ptr; | ||
} | ||
/** | ||
*/ | ||
export function start() { | ||
wasm.start(); | ||
} | ||
function handleError(f) { | ||
@@ -265,3 +259,3 @@ return function () { | ||
} | ||
function __wbg_adapter_189(arg0, arg1, arg2, arg3) { | ||
function __wbg_adapter_194(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3fe1d13911421f29(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
@@ -271,2 +265,5 @@ } | ||
/** | ||
*/ | ||
export const ButtplugErrorType = Object.freeze({ ConnectorError:0,"0":"ConnectorError",HandshakeError:1,"1":"HandshakeError",DeviceError:2,"2":"DeviceError",MessageError:3,"3":"MessageError",PingError:4,"4":"PingError",UnknownError:5,"5":"UnknownError", }); | ||
/** | ||
* Used in [MessageAttributes][crate::core::messages::MessageAttributes] for denoting message | ||
@@ -319,28 +316,4 @@ * capabilties. | ||
/** | ||
* @param {string} client_name | ||
* @param {ButtplugEmbeddedConnectorOptions} options | ||
* @returns {Promise<any>} | ||
*/ | ||
static connect_embedded(client_name, options) { | ||
var ptr0 = passStringToWasm0(client_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len0 = WASM_VECTOR_LEN; | ||
_assertClass(options, ButtplugEmbeddedConnectorOptions); | ||
var ret = wasm.buttplugclient_connect_embedded(ptr0, len0, options.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @param {string} client_name | ||
* @param {ButtplugWebsocketConnectorOptions} options | ||
* @returns {Promise<any>} | ||
*/ | ||
static connect_websocket(client_name, options) { | ||
var ptr0 = passStringToWasm0(client_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len0 = WASM_VECTOR_LEN; | ||
_assertClass(options, ButtplugWebsocketConnectorOptions); | ||
var ret = wasm.buttplugclient_connect_websocket(ptr0, len0, options.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {Promise<any>} | ||
*/ | ||
disconnect() { | ||
@@ -578,2 +551,9 @@ var ret = wasm.buttplugclient_disconnect(this.ptr); | ||
/** | ||
* @returns {Promise<any>} | ||
*/ | ||
stop() { | ||
var ret = wasm.buttplugclientdevice_stop(this.ptr); | ||
return takeObject(ret); | ||
} | ||
/** | ||
* @returns {any} | ||
@@ -748,2 +728,57 @@ */ | ||
*/ | ||
export class ButtplugError { | ||
static __wrap(ptr) { | ||
const obj = Object.create(ButtplugError.prototype); | ||
obj.ptr = ptr; | ||
return obj; | ||
} | ||
free() { | ||
const ptr = this.ptr; | ||
this.ptr = 0; | ||
wasm.__wbg_buttplugerror_free(ptr); | ||
} | ||
/** | ||
* @returns {number} | ||
*/ | ||
get error_type() { | ||
var ret = wasm.__wbg_get_buttplugerror_error_type(this.ptr); | ||
return ret >>> 0; | ||
} | ||
/** | ||
* @param {number} arg0 | ||
*/ | ||
set error_type(arg0) { | ||
wasm.__wbg_set_buttplugerror_error_type(this.ptr, arg0); | ||
} | ||
/** | ||
* @returns {string} | ||
*/ | ||
get reason() { | ||
try { | ||
const retptr = wasm.__wbindgen_export_6.value - 16; | ||
wasm.__wbindgen_export_6.value = retptr; | ||
wasm.buttplugerror_reason(retptr, this.ptr); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
return getStringFromWasm0(r0, r1); | ||
} finally { | ||
wasm.__wbindgen_export_6.value += 16; | ||
wasm.__wbindgen_free(r0, r1); | ||
} | ||
} | ||
/** | ||
* @param {string} reason | ||
*/ | ||
set reason(reason) { | ||
var ptr0 = passStringToWasm0(reason, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len0 = WASM_VECTOR_LEN; | ||
wasm.buttplugerror_set_reason(this.ptr, ptr0, len0); | ||
} | ||
} | ||
/** | ||
*/ | ||
export class ButtplugWebsocketConnectorOptions { | ||
@@ -866,2 +901,6 @@ | ||
}; | ||
imports.wbg.__wbg_buttplugerror_new = function(arg0) { | ||
var ret = ButtplugError.__wrap(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_number_new = function(arg0) { | ||
@@ -871,2 +910,10 @@ var ret = arg0; | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
var ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_null = function(arg0) { | ||
var ret = getObject(arg0) === null; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_cb_drop = function(arg0) { | ||
@@ -881,10 +928,2 @@ const obj = takeObject(arg0).original; | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
var ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_null = function(arg0) { | ||
var ret = getObject(arg0) === null; | ||
return ret; | ||
}; | ||
imports.wbg.__wbg_log_a73f6bdd88fae982 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { | ||
@@ -1105,3 +1144,3 @@ console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7)); | ||
try { | ||
return __wbg_adapter_189(a, state0.b, arg0, arg1); | ||
return __wbg_adapter_194(a, state0.b, arg0, arg1); | ||
} finally { | ||
@@ -1243,12 +1282,12 @@ state0.a = a; | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper1145 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 34, __wbg_adapter_38); | ||
imports.wbg.__wbindgen_closure_wrapper1287 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 130, __wbg_adapter_38); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper1147 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 32, __wbg_adapter_41); | ||
imports.wbg.__wbindgen_closure_wrapper1289 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 128, __wbg_adapter_41); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper6618 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 1893, __wbg_adapter_44); | ||
imports.wbg.__wbindgen_closure_wrapper6643 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 1902, __wbg_adapter_44); | ||
return addHeapObject(ret); | ||
@@ -1255,0 +1294,0 @@ }; |
@@ -0,1 +1,8 @@ | ||
# 1.0.0 Beta 4 (2020/12/05) | ||
## Features | ||
- Actually throw error types instead of just casting to strings. Error types are reduces from Rust's verbose enums, but this is good enough. | ||
- Add stop() method to devices. | ||
# 1.0.0 Beta 3 (2020/12/04) | ||
@@ -2,0 +9,0 @@ |
@@ -7,3 +7,3 @@ { | ||
"description": "Buttplug WASM library for web applications (Node/Web). Does not work for native node at the moment.", | ||
"version": "1.0.0-beta3", | ||
"version": "1.0.0-beta4", | ||
"license": "BSD-3-Clause", | ||
@@ -10,0 +10,0 @@ "homepage": "https://buttplug.io", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4468508
1848