UNPKG

node-buzzers

Version:

Forked version of 'buzz-buzzers', updated and upgraded to support multiple USB dongles

24 lines 1.01 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const hardware_1 = __importDefault(require("./hardware")); // eslint-disable-next-line @typescript-eslint/no-explicit-any function findDeviceByName(nodeHidLib) { const buzzDevice = nodeHidLib .devices() .find((d) => { var _a; return (_a = d === null || d === void 0 ? void 0 : d.product) === null || _a === void 0 ? void 0 : _a.match(/Buzz/); }); return new nodeHidLib.HID(buzzDevice.vendorId, buzzDevice.productId); } // eslint-disable-next-line @typescript-eslint/no-explicit-any function default_1(nodeHidLib) { try { return new nodeHidLib.HID(hardware_1.default.VENDOR_ID, hardware_1.default.PRODUCT_ID); } catch (err) { return findDeviceByName(nodeHidLib); } } exports.default = default_1; //# sourceMappingURL=connectDevice.js.map