ive-connect
Version:
A universal haptic device control library for interactive experiences
28 lines (27 loc) • 987 B
JavaScript
;
/**
* Buttplug Local Server
*
* Provides support for running a Buttplug server locally in the browser
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.isWebBluetoothSupported = isWebBluetoothSupported;
exports.generateClientName = generateClientName;
// This module provides functionality to create a local WebBluetooth connector
// The actual import of ButtplugWasmClientConnector is done dynamically in
// the ButtplugApi class to ensure it only runs in browser environments
/**
* Check if WebBluetooth is supported in the current environment
*/
function isWebBluetoothSupported() {
return (typeof window !== "undefined" &&
typeof window.navigator !== "undefined" &&
navigator.bluetooth !== undefined);
}
/**
* Generate name for the client
*/
function generateClientName(prefix = "IVE-Connect") {
// Add a random suffix to make the client name unique
return `${prefix}-${Math.floor(Math.random() * 10000)}`;
}