brilliantsole 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,6 +102,8 @@ declare class EventDispatcher<Target extends any, EventType extends string, Even
102
102
  target: Target;
103
103
  message: EventMessages[T];
104
104
  }) => void): void;
105
+ removeEventListeners<T extends EventType>(type: T): void;
106
+ removeAllEventListeners(): void;
105
107
  dispatchEvent<T extends EventType>(type: T, message: EventMessages[T]): void;
106
108
  waitForEvent<T extends EventType>(type: T): Promise<{
107
109
  type: T;
@@ -572,6 +574,8 @@ declare class Device {
572
574
  target: Device;
573
575
  message: DeviceEventMessages[T];
574
576
  }>;
577
+ get removeEventListeners(): <T extends "maxFileLength" | "getFileType" | "setFileType" | "getFileLength" | "setFileLength" | "getFileChecksum" | "setFileChecksum" | "setFileTransferCommand" | "fileTransferStatus" | "getFileBlock" | "setFileBlock" | "fileBytesTransferred" | "fileTransferProgress" | "fileTransferComplete" | "fileReceived" | "pressure" | "acceleration" | "gravity" | "linearAcceleration" | "gyroscope" | "magnetometer" | "gameRotation" | "rotation" | "orientation" | "activity" | "stepCounter" | "stepDetector" | "deviceOrientation" | "barometer" | "getPressurePositions" | "getSensorScalars" | "sensorData" | "getSensorConfiguration" | "setSensorConfiguration" | "getTfliteName" | "setTfliteName" | "getTfliteTask" | "setTfliteTask" | "getTfliteSampleRate" | "setTfliteSampleRate" | "getTfliteSensorTypes" | "setTfliteSensorTypes" | "tfliteIsReady" | "getTfliteCaptureDelay" | "setTfliteCaptureDelay" | "getTfliteThreshold" | "setTfliteThreshold" | "getTfliteInferencingEnabled" | "setTfliteInferencingEnabled" | "tfliteInference" | "manufacturerName" | "modelNumber" | "softwareRevision" | "hardwareRevision" | "firmwareRevision" | "pnpId" | "serialNumber" | "deviceInformation" | "isCharging" | "getBatteryCurrent" | "getMtu" | "getId" | "getName" | "setName" | "getType" | "setType" | "getCurrentTime" | "setCurrentTime" | "notConnected" | "connecting" | "connected" | "disconnecting" | "connectionStatus" | "isConnected" | "smp" | "batteryLevel" | "rx" | "tx" | "firmwareImages" | "firmwareUploadProgress" | "firmwareStatus" | "firmwareUploadComplete" | "connectionMessage">(type: T) => void;
578
+ get removeAllEventListeners(): () => void;
575
579
  get connectionManager(): BaseConnectionManager | undefined;
576
580
  set connectionManager(newConnectionManager: BaseConnectionManager | undefined);
577
581
  private sendTxMessages;
@@ -772,6 +776,8 @@ declare class DevicePair {
772
776
  target: DevicePair;
773
777
  message: DevicePairEventMessages[T];
774
778
  }>;
779
+ get removeEventListeners(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "devicePressure" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceBarometer" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "deviceSoftwareRevision" | "deviceHardwareRevision" | "deviceFirmwareRevision" | "devicePnpId" | "deviceSerialNumber" | "deviceDeviceInformation" | "deviceIsCharging" | "deviceGetBatteryCurrent" | "deviceGetMtu" | "deviceGetId" | "deviceGetName" | "deviceGetType" | "deviceGetCurrentTime" | "deviceNotConnected" | "deviceConnecting" | "deviceDisconnecting" | "deviceConnectionStatus" | "deviceSmp" | "deviceBatteryLevel" | "deviceFirmwareImages" | "deviceFirmwareUploadProgress" | "deviceFirmwareStatus" | "deviceConnectionMessage">(type: T) => void;
780
+ get removeAllEventListeners(): () => void;
775
781
  get left(): Device | undefined;
776
782
  get right(): Device | undefined;
777
783
  get isConnected(): boolean;
@@ -171,6 +171,8 @@ class EventDispatcher {
171
171
  this.listeners = {};
172
172
  this.addEventListener = this.addEventListener.bind(this);
173
173
  this.removeEventListener = this.removeEventListener.bind(this);
174
+ this.removeEventListeners = this.removeEventListeners.bind(this);
175
+ this.removeAllEventListeners = this.removeAllEventListeners.bind(this);
174
176
  this.dispatchEvent = this.dispatchEvent.bind(this);
175
177
  this.waitForEvent = this.waitForEvent.bind(this);
176
178
  }
@@ -222,6 +224,19 @@ class EventDispatcher {
222
224
  });
223
225
  this.updateEventListeners(type);
224
226
  }
227
+ removeEventListeners(type) {
228
+ if (!this.isValidEventType(type)) {
229
+ throw new Error(`Invalid event type: ${type}`);
230
+ }
231
+ if (!this.listeners[type])
232
+ return;
233
+ _console$A.log(`removing "${type}" listeners...`);
234
+ this.listeners[type] = [];
235
+ }
236
+ removeAllEventListeners() {
237
+ _console$A.log(`removing listeners...`);
238
+ this.listeners = {};
239
+ }
225
240
  dispatchEvent(type, message) {
226
241
  if (!this.isValidEventType(type)) {
227
242
  throw new Error(`Invalid event type: ${type}`);
@@ -3973,6 +3988,12 @@ class DeviceManager {
3973
3988
  get RemoveEventListener() {
3974
3989
  return __classPrivateFieldGet(this, _DeviceManager_EventDispatcher, "f").removeEventListener;
3975
3990
  }
3991
+ get RemoveEventListeners() {
3992
+ return __classPrivateFieldGet(this, _DeviceManager_EventDispatcher, "f").removeEventListeners;
3993
+ }
3994
+ get RemoveAllEventListeners() {
3995
+ return __classPrivateFieldGet(this, _DeviceManager_EventDispatcher, "f").removeAllEventListeners;
3996
+ }
3976
3997
  }
3977
3998
  _DeviceManager_boundDeviceEventListeners = new WeakMap(), _DeviceManager_ConnectedDevices = new WeakMap(), _DeviceManager_UseLocalStorage = new WeakMap(), _DeviceManager_DefaultLocalStorageConfiguration = new WeakMap(), _DeviceManager_LocalStorageConfiguration = new WeakMap(), _DeviceManager_LocalStorageKey = new WeakMap(), _DeviceManager_AvailableDevices = new WeakMap(), _DeviceManager_EventDispatcher = new WeakMap(), _DeviceManager_instances = new WeakSet(), _DeviceManager_onDeviceType = function _DeviceManager_onDeviceType(event) {
3978
3999
  if (__classPrivateFieldGet(this, _DeviceManager_UseLocalStorage, "f")) {
@@ -4192,6 +4213,12 @@ class Device {
4192
4213
  get waitForEvent() {
4193
4214
  return __classPrivateFieldGet(this, _Device_eventDispatcher, "f").waitForEvent;
4194
4215
  }
4216
+ get removeEventListeners() {
4217
+ return __classPrivateFieldGet(this, _Device_eventDispatcher, "f").removeEventListeners;
4218
+ }
4219
+ get removeAllEventListeners() {
4220
+ return __classPrivateFieldGet(this, _Device_eventDispatcher, "f").removeAllEventListeners;
4221
+ }
4195
4222
  get connectionManager() {
4196
4223
  return __classPrivateFieldGet(this, _Device_connectionManager, "f");
4197
4224
  }
@@ -4735,6 +4762,12 @@ class DevicePair {
4735
4762
  get waitForEvent() {
4736
4763
  return __classPrivateFieldGet(this, _DevicePair_eventDispatcher, "f").waitForEvent;
4737
4764
  }
4765
+ get removeEventListeners() {
4766
+ return __classPrivateFieldGet(this, _DevicePair_eventDispatcher, "f").removeEventListeners;
4767
+ }
4768
+ get removeAllEventListeners() {
4769
+ return __classPrivateFieldGet(this, _DevicePair_eventDispatcher, "f").removeAllEventListeners;
4770
+ }
4738
4771
  get left() {
4739
4772
  return __classPrivateFieldGet(this, _DevicePair_left, "f");
4740
4773
  }