@opendisplay/opendisplay 1.1.0 → 1.1.1

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.
package/dist/index.cjs CHANGED
@@ -1396,6 +1396,16 @@ var BLEConnection = class {
1396
1396
  }
1397
1397
  return this.notificationQueue.dequeue(timeoutMs);
1398
1398
  }
1399
+ /**
1400
+ * Clear the notification queue.
1401
+ *
1402
+ * Useful for clearing any stale responses before starting a new operation.
1403
+ * This drains any buffered notifications and cancels pending read requests.
1404
+ */
1405
+ clearQueue() {
1406
+ console.debug(`Clearing notification queue (${this.notificationQueue.size} buffered)`);
1407
+ this.notificationQueue.clear("Queue cleared by request");
1408
+ }
1399
1409
  /**
1400
1410
  * Handle incoming BLE notifications.
1401
1411
  *
@@ -1796,6 +1806,7 @@ var OpenDisplayDevice = class _OpenDisplayDevice {
1796
1806
  onProgress,
1797
1807
  onStatusChange
1798
1808
  } = params;
1809
+ this.connection.clearQueue();
1799
1810
  let startCmd;
1800
1811
  let remainingCompressed = null;
1801
1812
  if (useCompression && compressedData && uncompressedSize) {