@oxog/devinspector 1.5.0 → 1.5.2

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @oxog/devinspector v1.5.0
2
+ * @oxog/devinspector v1.5.2
3
3
  * (c) Ersin Koc <ersinkoc@gmail.com>
4
4
  * Released under the MIT License
5
5
  */
@@ -335,7 +335,7 @@
335
335
  }
336
336
 
337
337
  /** Package version, kept in sync with package.json (checked by tests). */
338
- const VERSION = '1.5.0';
338
+ const VERSION = '1.5.2';
339
339
 
340
340
  /**
341
341
  * DevInspector - the default inspector: floating widget plus a panel with
@@ -632,8 +632,9 @@
632
632
  if (!this.isEnabled)
633
633
  return;
634
634
  this.isMinimized = !this.isMinimized;
635
+ // Minimized, the panel is as tall as its header (a fixed height clipped it).
635
636
  if (this.panel)
636
- this.panel.style.height = this.isMinimized ? '48px' : '650px';
637
+ this.panel.style.height = this.isMinimized ? 'auto' : '650px';
637
638
  this.render();
638
639
  this.events.emit('inspector:minimize', this.isMinimized);
639
640
  }
@@ -2392,7 +2393,7 @@
2392
2393
  result = func.apply(thisArg, args);
2393
2394
  return result;
2394
2395
  };
2395
- return function throttled(...args) {
2396
+ const throttled = function (...args) {
2396
2397
  const now = Date.now();
2397
2398
  const remaining = wait - (now - lastCallTime);
2398
2399
  // eslint-disable-next-line @typescript-eslint/no-this-alias
@@ -2419,6 +2420,15 @@
2419
2420
  }
2420
2421
  return result;
2421
2422
  };
2423
+ /** Drops a pending trailing call and its timer. */
2424
+ throttled.cancel = () => {
2425
+ if (timeout) {
2426
+ clearTimeout(timeout);
2427
+ timeout = null;
2428
+ }
2429
+ lastArgs = lastThis = null;
2430
+ };
2431
+ return throttled;
2422
2432
  }
2423
2433
  function generateId() {
2424
2434
  return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
@@ -2807,9 +2817,12 @@
2807
2817
  return;
2808
2818
  // eslint-disable-next-line @typescript-eslint/no-this-alias
2809
2819
  const self = this;
2810
- XMLHttpRequest.prototype.open = function (method, url, async = true, username, password) {
2820
+ XMLHttpRequest.prototype.open = function (...args) {
2811
2821
  var _a;
2812
- const result = self.originalOpen.apply(this, [method, url, async, username, password]);
2822
+ // The arguments go through as given: an explicit `async: undefined` means a
2823
+ // synchronous request, and the native open() distinguishes 2 from 3+ arguments.
2824
+ const result = self.originalOpen.apply(this, args);
2825
+ const [method, url] = args;
2813
2826
  // open() on a request in flight cancels it without abort/loadend events.
2814
2827
  (_a = this._devinspectorCancel) === null || _a === void 0 ? void 0 : _a.call(this);
2815
2828
  this._devinspectorId = generateId();
@@ -4459,7 +4472,9 @@
4459
4472
  this.metricsCollector = new MetricsCollector(this.handleMetrics.bind(this));
4460
4473
  this.longTaskDetector = new LongTaskDetector(this.handleLongTask.bind(this));
4461
4474
  // Throttle the performance data emission
4462
- this.emitPerformanceData = throttle(this.emitPerformanceData.bind(this), 100);
4475
+ const throttledEmit = throttle(this.emitPerformanceData.bind(this), 100);
4476
+ this.emitPerformanceData = throttledEmit;
4477
+ this.cancelPendingEmit = throttledEmit.cancel;
4463
4478
  }
4464
4479
  start() {
4465
4480
  if (this.isActive)
@@ -4479,6 +4494,8 @@
4479
4494
  this.memoryMonitor.stop();
4480
4495
  this.metricsCollector.stop();
4481
4496
  this.longTaskDetector.stop();
4497
+ // A trailing emission still pending must not fire after stop()
4498
+ this.cancelPendingEmit();
4482
4499
  this.isActive = false;
4483
4500
  }
4484
4501
  handleFPSData(data) {