@rive-app/webgl 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/webgl",
3
- "version": "2.26.1",
3
+ "version": "2.26.2",
4
4
  "description": "Rive's webgl 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
@@ -408,7 +408,7 @@ function Qa(a, b) {
408
408
  return Pa(c, a, b);
409
409
  }));
410
410
  }
411
- var Ra, Sa, Wa = {702412:(a, b, c, d, e) => {
411
+ var Ra, Sa, Wa = {702476:(a, b, c, d, e) => {
412
412
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
413
413
  return 0;
414
414
  }
@@ -471,9 +471,9 @@ var Ra, Sa, Wa = {702412:(a, b, c, d, e) => {
471
471
  }
472
472
  window.h.Ea += 1;
473
473
  return 1;
474
- }, 704590:() => {
474
+ }, 704654:() => {
475
475
  "undefined" !== typeof window.h && (--window.h.Ea, 0 === window.h.Ea && delete window.h);
476
- }, 704754:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 704858:() => {
476
+ }, 704818:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 704922:() => {
477
477
  try {
478
478
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
479
479
  a.close();
@@ -481,7 +481,7 @@ var Ra, Sa, Wa = {702412:(a, b, c, d, e) => {
481
481
  } catch (c) {
482
482
  return 0;
483
483
  }
484
- }, 705029:(a, b, c, d, e, f) => {
484
+ }, 705093:(a, b, c, d, e, f) => {
485
485
  if ("undefined" === typeof window.h) {
486
486
  return -1;
487
487
  }
@@ -527,7 +527,7 @@ var Ra, Sa, Wa = {702412:(a, b, c, d, e) => {
527
527
  a == window.h.H.Ca && g.X.connect(g.I.destination);
528
528
  g.lb = f;
529
529
  return window.h.nc(g);
530
- }, 707906:a => window.h.ta(a).I.sampleRate, 707979:a => {
530
+ }, 707970:a => window.h.ta(a).I.sampleRate, 708043:a => {
531
531
  a = window.h.ta(a);
532
532
  void 0 !== a.X && (a.X.onaudioprocess = function() {
533
533
  }, a.X.disconnect(), a.X = void 0);
@@ -535,13 +535,13 @@ var Ra, Sa, Wa = {702412:(a, b, c, d, e) => {
535
535
  a.I.close();
536
536
  a.I = void 0;
537
537
  a.lb = void 0;
538
- }, 708379:a => {
538
+ }, 708443:a => {
539
539
  window.h.xb(a);
540
- }, 708429:a => {
540
+ }, 708493:a => {
541
541
  a = window.h.ta(a);
542
542
  a.I.resume();
543
543
  a.state = window.h.ha.sb;
544
- }, 708568:a => {
544
+ }, 708632:a => {
545
545
  a = window.h.ta(a);
546
546
  a.I.suspend();
547
547
  a.state = window.h.ha.stopped;
@@ -4061,7 +4061,7 @@ Je();
4061
4061
  /* 2 */
4062
4062
  /***/ ((module) => {
4063
4063
 
4064
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl","version":"2.26.1","description":"Rive\'s webgl 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.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4064
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl","version":"2.26.2","description":"Rive\'s webgl 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.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4065
4065
 
4066
4066
  /***/ }),
4067
4067
  /* 3 */
@@ -5847,6 +5847,8 @@ var Rive = /** @class */ (function () {
5847
5847
  var _a;
5848
5848
  // Tracks if a Rive file is loaded
5849
5849
  this.loaded = false;
5850
+ // Tracks if a Rive file is destroyed
5851
+ this.destroyed = false;
5850
5852
  // Reference of an object that handles any observers for the animation
5851
5853
  this._observed = null;
5852
5854
  /**
@@ -5983,12 +5985,15 @@ var Rive = /** @class */ (function () {
5983
5985
  Rive.prototype.init = function (_a) {
5984
5986
  var _this = this;
5985
5987
  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;
5988
+ if (this.destroyed) {
5989
+ return;
5990
+ }
5986
5991
  this.src = src;
5987
5992
  this.buffer = buffer;
5988
5993
  this.riveFile = riveFile;
5989
5994
  // If no source file url specified, it's a bust
5990
5995
  if (!this.src && !this.buffer && !this.riveFile) {
5991
- throw new Error(Rive.missingErrorMessage);
5996
+ throw new RiveError(Rive.missingErrorMessage);
5992
5997
  }
5993
5998
  // List of animations that should be initialized.
5994
5999
  var startingAnimationNames = mapToStringArray(animations);
@@ -6000,6 +6005,9 @@ var Rive = /** @class */ (function () {
6000
6005
  // Ensure the runtime is loaded
6001
6006
  RuntimeLoader.awaitInstance()
6002
6007
  .then(function (runtime) {
6008
+ if (_this.destroyed) {
6009
+ return;
6010
+ }
6003
6011
  _this.runtime = runtime;
6004
6012
  _this.removeRiveListeners();
6005
6013
  _this.deleteRiveRenderer();
@@ -6372,6 +6380,7 @@ var Rive = /** @class */ (function () {
6372
6380
  */
6373
6381
  Rive.prototype.cleanup = function () {
6374
6382
  var _a;
6383
+ this.destroyed = true;
6375
6384
  // Stop the renderer if it hasn't already been stopped.
6376
6385
  this.stopRendering();
6377
6386
  // Clean up any artboard, animation or state machine instances.
@@ -6381,9 +6390,11 @@ var Rive = /** @class */ (function () {
6381
6390
  observers.remove(this._observed);
6382
6391
  }
6383
6392
  this.removeRiveListeners();
6384
- (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
6393
+ if (this.file) {
6394
+ (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
6395
+ this.file = null;
6396
+ }
6385
6397
  this.riveFile = null;
6386
- this.file = null;
6387
6398
  this.deleteRiveRenderer();
6388
6399
  if (this._audioEventListener !== null) {
6389
6400
  audioManager.remove(this._audioEventListener);