@rive-app/webgl2 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/webgl2",
3
- "version": "2.26.1",
3
+ "version": "2.26.2",
4
4
  "description": "Rive's webgl2 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
@@ -435,7 +435,7 @@ function Na(a, b) {
435
435
  return Ma(c, a, b);
436
436
  }));
437
437
  }
438
- var Oa, Pa, Ta = {505214:(a, b, c, d, e) => {
438
+ var Oa, Pa, Ta = {505310:(a, b, c, d, e) => {
439
439
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
440
440
  return 0;
441
441
  }
@@ -498,9 +498,9 @@ var Oa, Pa, Ta = {505214:(a, b, c, d, e) => {
498
498
  }
499
499
  window.h.Da += 1;
500
500
  return 1;
501
- }, 507392:() => {
501
+ }, 507488:() => {
502
502
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
503
- }, 507556:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 507660:() => {
503
+ }, 507652:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 507756:() => {
504
504
  try {
505
505
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
506
506
  a.close();
@@ -508,7 +508,7 @@ var Oa, Pa, Ta = {505214:(a, b, c, d, e) => {
508
508
  } catch (c) {
509
509
  return 0;
510
510
  }
511
- }, 507831:(a, b, c, d, e, f) => {
511
+ }, 507927:(a, b, c, d, e, f) => {
512
512
  if ("undefined" === typeof window.h) {
513
513
  return -1;
514
514
  }
@@ -554,7 +554,7 @@ var Oa, Pa, Ta = {505214:(a, b, c, d, e) => {
554
554
  a == window.h.I.Ba && g.Z.connect(g.J.destination);
555
555
  g.lb = f;
556
556
  return window.h.nc(g);
557
- }, 510708:a => window.h.va(a).J.sampleRate, 510781:a => {
557
+ }, 510804:a => window.h.va(a).J.sampleRate, 510877:a => {
558
558
  a = window.h.va(a);
559
559
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
560
560
  }, a.Z.disconnect(), a.Z = void 0);
@@ -562,13 +562,13 @@ var Oa, Pa, Ta = {505214:(a, b, c, d, e) => {
562
562
  a.J.close();
563
563
  a.J = void 0;
564
564
  a.lb = void 0;
565
- }, 511181:a => {
565
+ }, 511277:a => {
566
566
  window.h.yb(a);
567
- }, 511231:a => {
567
+ }, 511327:a => {
568
568
  a = window.h.va(a);
569
569
  a.J.resume();
570
570
  a.state = window.h.ia.tb;
571
- }, 511370:a => {
571
+ }, 511466:a => {
572
572
  a = window.h.va(a);
573
573
  a.J.suspend();
574
574
  a.state = window.h.ia.stopped;
@@ -3483,8 +3483,8 @@ m.dynCall_viijii = (a, b, c, d, e, f, g) => (m.dynCall_viijii = B.dynCall_viijii
3483
3483
  m.dynCall_iiiiij = (a, b, c, d, e, f, g) => (m.dynCall_iiiiij = B.dynCall_iiiiij)(a, b, c, d, e, f, g);
3484
3484
  m.dynCall_iiiiijj = (a, b, c, d, e, f, g, n, p) => (m.dynCall_iiiiijj = B.dynCall_iiiiijj)(a, b, c, d, e, f, g, n, p);
3485
3485
  m.dynCall_iiiiiijj = (a, b, c, d, e, f, g, n, p, l) => (m.dynCall_iiiiiijj = B.dynCall_iiiiiijj)(a, b, c, d, e, f, g, n, p, l);
3486
- m.___start_em_js = 502780;
3487
- m.___stop_em_js = 505214;
3486
+ m.___start_em_js = 502876;
3487
+ m.___stop_em_js = 505310;
3488
3488
  var Yd;
3489
3489
  Ga = function Zd() {
3490
3490
  Yd || $d();
@@ -3544,7 +3544,7 @@ $d();
3544
3544
  /* 2 */
3545
3545
  /***/ ((module) => {
3546
3546
 
3547
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.26.1","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3547
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.26.2","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3548
3548
 
3549
3549
  /***/ }),
3550
3550
  /* 3 */
@@ -5330,6 +5330,8 @@ var Rive = /** @class */ (function () {
5330
5330
  var _a;
5331
5331
  // Tracks if a Rive file is loaded
5332
5332
  this.loaded = false;
5333
+ // Tracks if a Rive file is destroyed
5334
+ this.destroyed = false;
5333
5335
  // Reference of an object that handles any observers for the animation
5334
5336
  this._observed = null;
5335
5337
  /**
@@ -5466,12 +5468,15 @@ var Rive = /** @class */ (function () {
5466
5468
  Rive.prototype.init = function (_a) {
5467
5469
  var _this = this;
5468
5470
  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;
5471
+ if (this.destroyed) {
5472
+ return;
5473
+ }
5469
5474
  this.src = src;
5470
5475
  this.buffer = buffer;
5471
5476
  this.riveFile = riveFile;
5472
5477
  // If no source file url specified, it's a bust
5473
5478
  if (!this.src && !this.buffer && !this.riveFile) {
5474
- throw new Error(Rive.missingErrorMessage);
5479
+ throw new RiveError(Rive.missingErrorMessage);
5475
5480
  }
5476
5481
  // List of animations that should be initialized.
5477
5482
  var startingAnimationNames = mapToStringArray(animations);
@@ -5483,6 +5488,9 @@ var Rive = /** @class */ (function () {
5483
5488
  // Ensure the runtime is loaded
5484
5489
  RuntimeLoader.awaitInstance()
5485
5490
  .then(function (runtime) {
5491
+ if (_this.destroyed) {
5492
+ return;
5493
+ }
5486
5494
  _this.runtime = runtime;
5487
5495
  _this.removeRiveListeners();
5488
5496
  _this.deleteRiveRenderer();
@@ -5855,6 +5863,7 @@ var Rive = /** @class */ (function () {
5855
5863
  */
5856
5864
  Rive.prototype.cleanup = function () {
5857
5865
  var _a;
5866
+ this.destroyed = true;
5858
5867
  // Stop the renderer if it hasn't already been stopped.
5859
5868
  this.stopRendering();
5860
5869
  // Clean up any artboard, animation or state machine instances.
@@ -5864,9 +5873,11 @@ var Rive = /** @class */ (function () {
5864
5873
  observers.remove(this._observed);
5865
5874
  }
5866
5875
  this.removeRiveListeners();
5867
- (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5876
+ if (this.file) {
5877
+ (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5878
+ this.file = null;
5879
+ }
5868
5880
  this.riveFile = null;
5869
- this.file = null;
5870
5881
  this.deleteRiveRenderer();
5871
5882
  if (this._audioEventListener !== null) {
5872
5883
  audioManager.remove(this._audioEventListener);