@waveform-playlist/browser 15.3.2 → 15.3.3

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.mjs CHANGED
@@ -1575,6 +1575,12 @@ function createPeaksWorker() {
1575
1575
  generate() {
1576
1576
  return Promise.reject(new Error("Worker creation failed"));
1577
1577
  },
1578
+ // Reports NOT terminated: CSP blocking is permanent for the page, so
1579
+ // recreating on every call would just re-attempt (and re-warn about)
1580
+ // Worker construction each time.
1581
+ isTerminated() {
1582
+ return false;
1583
+ },
1578
1584
  terminate() {
1579
1585
  }
1580
1586
  };
@@ -1607,6 +1613,9 @@ function createPeaksWorker() {
1607
1613
  pending.clear();
1608
1614
  };
1609
1615
  return {
1616
+ isTerminated() {
1617
+ return terminated;
1618
+ },
1610
1619
  generate(params) {
1611
1620
  if (terminated) return Promise.reject(new Error("Worker terminated"));
1612
1621
  const messageId = String(++idCounter);
@@ -1649,7 +1658,7 @@ function useWaveformDataCache(tracks, baseScale) {
1649
1658
  const subscribersByBufferRef = useRef8(/* @__PURE__ */ new WeakMap());
1650
1659
  const pendingCountRef = useRef8(0);
1651
1660
  const getWorker = useCallback12(() => {
1652
- if (!workerRef.current) {
1661
+ if (!workerRef.current || workerRef.current.isTerminated()) {
1653
1662
  workerRef.current = createPeaksWorker();
1654
1663
  }
1655
1664
  return workerRef.current;