@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.js CHANGED
@@ -1340,6 +1340,16 @@ var BLEConnection = class {
1340
1340
  }
1341
1341
  return this.notificationQueue.dequeue(timeoutMs);
1342
1342
  }
1343
+ /**
1344
+ * Clear the notification queue.
1345
+ *
1346
+ * Useful for clearing any stale responses before starting a new operation.
1347
+ * This drains any buffered notifications and cancels pending read requests.
1348
+ */
1349
+ clearQueue() {
1350
+ console.debug(`Clearing notification queue (${this.notificationQueue.size} buffered)`);
1351
+ this.notificationQueue.clear("Queue cleared by request");
1352
+ }
1343
1353
  /**
1344
1354
  * Handle incoming BLE notifications.
1345
1355
  *
@@ -1740,6 +1750,7 @@ var OpenDisplayDevice = class _OpenDisplayDevice {
1740
1750
  onProgress,
1741
1751
  onStatusChange
1742
1752
  } = params;
1753
+ this.connection.clearQueue();
1743
1754
  let startCmd;
1744
1755
  let remainingCompressed = null;
1745
1756
  if (useCompression && compressedData && uncompressedSize) {