@blackmagic-controller/core
Version:
An npm module for interfacing with the Blackmagic usb/bluetooth controllers
102 lines • 2.77 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlackmagicControllerProxy = void 0;
/**
* A minimal proxy around a BlackmagicController instance.
* This is intended to be used by libraries wrapping this that want to add more methods to the BlackmagicController
*/
class BlackmagicControllerProxy {
device;
constructor(device) {
this.device = device;
}
get CONTROLS() {
return this.device.CONTROLS;
}
get MODEL() {
return this.device.MODEL;
}
get PRODUCT_NAME() {
return this.device.PRODUCT_NAME;
}
async close() {
return this.device.close();
}
async getHidDeviceInfo(...args) {
return this.device.getHidDeviceInfo(...args);
}
async setButtonColor(...args) {
return this.device.setButtonColor(...args);
}
async setButtonColors(...args) {
return this.device.setButtonColors(...args);
}
async setTbarLeds(...args) {
return this.device.setTbarLeds(...args);
}
async clearKey(...args) {
return this.device.clearKey(...args);
}
async clearPanel(...args) {
return this.device.clearPanel(...args);
}
async getBatteryLevel() {
return this.device.getBatteryLevel();
}
async getFirmwareVersion() {
return this.device.getFirmwareVersion();
}
async getSerialNumber() {
return this.device.getSerialNumber();
}
/**
* EventEmitter
*/
eventNames() {
return this.device.eventNames();
}
listeners(event) {
return this.device.listeners(event);
}
listenerCount(event) {
return this.device.listenerCount(event);
}
emit(event, ...args) {
return this.device.emit(event, ...args);
}
/**
* Add a listener for a given event.
*/
on(event, fn, context) {
this.device.on(event, fn, context);
return this;
}
addListener(event, fn, context) {
this.device.addListener(event, fn, context);
return this;
}
/**
* Add a one-time listener for a given event.
*/
once(event, fn, context) {
this.device.once(event, fn, context);
return this;
}
/**
* Remove the listeners of a given event.
*/
removeListener(event, fn, context, once) {
this.device.removeListener(event, fn, context, once);
return this;
}
off(event, fn, context, once) {
this.device.off(event, fn, context, once);
return this;
}
removeAllListeners(event) {
this.device.removeAllListeners(event);
return this;
}
}
exports.BlackmagicControllerProxy = BlackmagicControllerProxy;
//# sourceMappingURL=proxy.js.map