@checksub_team/peaks_timeline 2.0.1 → 2.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checksub_team/peaks_timeline",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "JavaScript UI component for displaying audio waveforms",
5
5
  "main": "./peaks.js",
6
6
  "types": "./peaks.js.d.ts",
package/peaks.js CHANGED
@@ -17752,6 +17752,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
17752
17752
  this._selected = this._source.selected;
17753
17753
  this._hovered = false;
17754
17754
  this._isDragged = false;
17755
+ this._destroyed = false;
17755
17756
  this._previewList = [];
17756
17757
  this._previewBuildQueue = new Set();
17757
17758
  this._markersGroup = this._createMarkers();
@@ -18336,6 +18337,9 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
18336
18337
  options.dataUri = content;
18337
18338
  }
18338
18339
  waveformBuilder.init(options, function (err, originalWaveformData) {
18340
+ if (self._destroyed) {
18341
+ return;
18342
+ }
18339
18343
  if (err) {
18340
18344
  throw err;
18341
18345
  }
@@ -19007,6 +19011,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Loader, Utils, Konva)
19007
19011
  this._loader = null;
19008
19012
  }
19009
19013
  this._group.destroy();
19014
+ this._destroyed = true;
19010
19015
  };
19011
19016
  SourceGroup.getHeights = function (source, peaks) {
19012
19017
  var unwrappedHeight = source.binaryHeight && source.previewHeight ? source.binaryHeight + source.previewHeight : peaks.options.lineHeight;
@@ -59,6 +59,7 @@ define([
59
59
  this._selected = this._source.selected;
60
60
  this._hovered = false;
61
61
  this._isDragged = false;
62
+ this._destroyed = false;
62
63
 
63
64
  this._previewList = [];
64
65
  // internal queue state for async preview creation
@@ -842,6 +843,10 @@ define([
842
843
  }
843
844
 
844
845
  waveformBuilder.init(options, function(err, originalWaveformData) {
846
+ if (self._destroyed) {
847
+ return;
848
+ }
849
+
845
850
  if (err) {
846
851
  throw err;
847
852
  }
@@ -1713,6 +1718,8 @@ define([
1713
1718
  }
1714
1719
 
1715
1720
  this._group.destroy();
1721
+
1722
+ this._destroyed = true;
1716
1723
  };
1717
1724
 
1718
1725
  /**
@@ -346,7 +346,7 @@ define([
346
346
  * @param {WaveformBuilderInitCallback} callback
347
347
  */
348
348
 
349
- WaveformBuilder.prototype._buildWaveformDataFromObjectUrl = function(options, callback) {
349
+ WaveformBuilder.prototype._buildWaveformDataFromObjectUrl = function(options, callback) {
350
350
  var self = this;
351
351
 
352
352
  var webAudioOptions = {