@waveform-playlist/browser 15.3.1 → 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.js CHANGED
@@ -1657,6 +1657,12 @@ function createPeaksWorker() {
1657
1657
  generate() {
1658
1658
  return Promise.reject(new Error("Worker creation failed"));
1659
1659
  },
1660
+ // Reports NOT terminated: CSP blocking is permanent for the page, so
1661
+ // recreating on every call would just re-attempt (and re-warn about)
1662
+ // Worker construction each time.
1663
+ isTerminated() {
1664
+ return false;
1665
+ },
1660
1666
  terminate() {
1661
1667
  }
1662
1668
  };
@@ -1689,6 +1695,9 @@ function createPeaksWorker() {
1689
1695
  pending.clear();
1690
1696
  };
1691
1697
  return {
1698
+ isTerminated() {
1699
+ return terminated;
1700
+ },
1692
1701
  generate(params) {
1693
1702
  if (terminated) return Promise.reject(new Error("Worker terminated"));
1694
1703
  const messageId = String(++idCounter);
@@ -1731,7 +1740,7 @@ function useWaveformDataCache(tracks, baseScale) {
1731
1740
  const subscribersByBufferRef = (0, import_react16.useRef)(/* @__PURE__ */ new WeakMap());
1732
1741
  const pendingCountRef = (0, import_react16.useRef)(0);
1733
1742
  const getWorker = (0, import_react16.useCallback)(() => {
1734
- if (!workerRef.current) {
1743
+ if (!workerRef.current || workerRef.current.isTerminated()) {
1735
1744
  workerRef.current = createPeaksWorker();
1736
1745
  }
1737
1746
  return workerRef.current;