@rive-app/canvas 2.26.1 → 2.26.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": "@rive-app/canvas",
3
- "version": "2.26.1",
3
+ "version": "2.26.2",
4
4
  "description": "Rive's canvas based web api.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -340,6 +340,7 @@ export declare class Rive {
340
340
  private _layout;
341
341
  private renderer;
342
342
  private loaded;
343
+ private destroyed;
343
344
  private _observed;
344
345
  /**
345
346
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
package/rive.js CHANGED
@@ -746,7 +746,7 @@ function Ya(a, b) {
746
746
  return Xa(c, a, b);
747
747
  }));
748
748
  }
749
- var Za, $a, db = {447260:(a, b, c, d, e) => {
749
+ var Za, $a, db = {447324:(a, b, c, d, e) => {
750
750
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
751
751
  return 0;
752
752
  }
@@ -809,9 +809,9 @@ var Za, $a, db = {447260:(a, b, c, d, e) => {
809
809
  }
810
810
  window.h.Aa += 1;
811
811
  return 1;
812
- }, 449438:() => {
812
+ }, 449502:() => {
813
813
  "undefined" !== typeof window.h && (--window.h.Aa, 0 === window.h.Aa && delete window.h);
814
- }, 449602:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 449706:() => {
814
+ }, 449666:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 449770:() => {
815
815
  try {
816
816
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
817
817
  a.close();
@@ -819,7 +819,7 @@ var Za, $a, db = {447260:(a, b, c, d, e) => {
819
819
  } catch (c) {
820
820
  return 0;
821
821
  }
822
- }, 449877:(a, b, c, d, e, f) => {
822
+ }, 449941:(a, b, c, d, e, f) => {
823
823
  if ("undefined" === typeof window.h) {
824
824
  return -1;
825
825
  }
@@ -865,7 +865,7 @@ var Za, $a, db = {447260:(a, b, c, d, e) => {
865
865
  a == window.h.I.ya && g.Z.connect(g.J.destination);
866
866
  g.pb = f;
867
867
  return window.h.yc(g);
868
- }, 452754:a => window.h.ra(a).J.sampleRate, 452827:a => {
868
+ }, 452818:a => window.h.ra(a).J.sampleRate, 452891:a => {
869
869
  a = window.h.ra(a);
870
870
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
871
871
  }, a.Z.disconnect(), a.Z = void 0);
@@ -873,13 +873,13 @@ var Za, $a, db = {447260:(a, b, c, d, e) => {
873
873
  a.J.close();
874
874
  a.J = void 0;
875
875
  a.pb = void 0;
876
- }, 453227:a => {
876
+ }, 453291:a => {
877
877
  window.h.Cb(a);
878
- }, 453277:a => {
878
+ }, 453341:a => {
879
879
  a = window.h.ra(a);
880
880
  a.J.resume();
881
881
  a.state = window.h.ga.xb;
882
- }, 453416:a => {
882
+ }, 453480:a => {
883
883
  a = window.h.ra(a);
884
884
  a.J.suspend();
885
885
  a.state = window.h.ga.stopped;
@@ -3365,7 +3365,7 @@ $d();
3365
3365
  /* 2 */
3366
3366
  /***/ ((module) => {
3367
3367
 
3368
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.26.1","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3368
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.26.2","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3369
3369
 
3370
3370
  /***/ }),
3371
3371
  /* 3 */
@@ -5151,6 +5151,8 @@ var Rive = /** @class */ (function () {
5151
5151
  var _a;
5152
5152
  // Tracks if a Rive file is loaded
5153
5153
  this.loaded = false;
5154
+ // Tracks if a Rive file is destroyed
5155
+ this.destroyed = false;
5154
5156
  // Reference of an object that handles any observers for the animation
5155
5157
  this._observed = null;
5156
5158
  /**
@@ -5287,12 +5289,15 @@ var Rive = /** @class */ (function () {
5287
5289
  Rive.prototype.init = function (_a) {
5288
5290
  var _this = this;
5289
5291
  var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c;
5292
+ if (this.destroyed) {
5293
+ return;
5294
+ }
5290
5295
  this.src = src;
5291
5296
  this.buffer = buffer;
5292
5297
  this.riveFile = riveFile;
5293
5298
  // If no source file url specified, it's a bust
5294
5299
  if (!this.src && !this.buffer && !this.riveFile) {
5295
- throw new Error(Rive.missingErrorMessage);
5300
+ throw new RiveError(Rive.missingErrorMessage);
5296
5301
  }
5297
5302
  // List of animations that should be initialized.
5298
5303
  var startingAnimationNames = mapToStringArray(animations);
@@ -5304,6 +5309,9 @@ var Rive = /** @class */ (function () {
5304
5309
  // Ensure the runtime is loaded
5305
5310
  RuntimeLoader.awaitInstance()
5306
5311
  .then(function (runtime) {
5312
+ if (_this.destroyed) {
5313
+ return;
5314
+ }
5307
5315
  _this.runtime = runtime;
5308
5316
  _this.removeRiveListeners();
5309
5317
  _this.deleteRiveRenderer();
@@ -5676,6 +5684,7 @@ var Rive = /** @class */ (function () {
5676
5684
  */
5677
5685
  Rive.prototype.cleanup = function () {
5678
5686
  var _a;
5687
+ this.destroyed = true;
5679
5688
  // Stop the renderer if it hasn't already been stopped.
5680
5689
  this.stopRendering();
5681
5690
  // Clean up any artboard, animation or state machine instances.
@@ -5685,9 +5694,11 @@ var Rive = /** @class */ (function () {
5685
5694
  observers.remove(this._observed);
5686
5695
  }
5687
5696
  this.removeRiveListeners();
5688
- (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5697
+ if (this.file) {
5698
+ (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5699
+ this.file = null;
5700
+ }
5689
5701
  this.riveFile = null;
5690
- this.file = null;
5691
5702
  this.deleteRiveRenderer();
5692
5703
  if (this._audioEventListener !== null) {
5693
5704
  audioManager.remove(this._audioEventListener);