@rive-app/webgl2 2.24.0 → 2.24.1

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.24.0",
3
+ "version": "2.24.1",
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
@@ -103,6 +103,10 @@ export declare class StateMachineInput {
103
103
  * Fires a trigger; does nothing on Number or Boolean input types
104
104
  */
105
105
  fire(): void;
106
+ /**
107
+ * Deletes the input
108
+ */
109
+ delete(): void;
106
110
  }
107
111
  export declare enum RiveEventType {
108
112
  General = 128,
package/rive.js CHANGED
@@ -3527,7 +3527,7 @@ Zd();
3527
3527
  /* 2 */
3528
3528
  /***/ ((module) => {
3529
3529
 
3530
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.24.0","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}}');
3530
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.24.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}}');
3531
3531
 
3532
3532
  /***/ }),
3533
3533
  /* 3 */
@@ -4321,6 +4321,12 @@ var StateMachineInput = /** @class */ (function () {
4321
4321
  this.runtimeInput.fire();
4322
4322
  }
4323
4323
  };
4324
+ /**
4325
+ * Deletes the input
4326
+ */
4327
+ StateMachineInput.prototype.delete = function () {
4328
+ this.runtimeInput = null;
4329
+ };
4324
4330
  return StateMachineInput;
4325
4331
  }());
4326
4332
 
@@ -4422,6 +4428,10 @@ var StateMachine = /** @class */ (function () {
4422
4428
  * state machine is no more.
4423
4429
  */
4424
4430
  StateMachine.prototype.cleanup = function () {
4431
+ this.inputs.forEach(function (input) {
4432
+ input.delete();
4433
+ });
4434
+ this.inputs.length = 0;
4425
4435
  this.instance.delete();
4426
4436
  };
4427
4437
  return StateMachine;
@@ -5266,6 +5276,8 @@ var Rive = /** @class */ (function () {
5266
5276
  var _a;
5267
5277
  // Tracks if a Rive file is loaded
5268
5278
  this.loaded = false;
5279
+ // Reference of an object that handles any observers for the animation
5280
+ this._observed = null;
5269
5281
  /**
5270
5282
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
5271
5283
  * commands (e.g. contents) can be called as soon as the file is loaded.
@@ -5407,6 +5419,8 @@ var Rive = /** @class */ (function () {
5407
5419
  RuntimeLoader.awaitInstance()
5408
5420
  .then(function (runtime) {
5409
5421
  _this.runtime = runtime;
5422
+ _this.removeRiveListeners();
5423
+ _this.deleteRiveRenderer();
5410
5424
  // Get the canvas where you want to render the animation and create a renderer
5411
5425
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
5412
5426
  // Initial size adjustment based on devicePixelRatio if no width/height are
@@ -5461,6 +5475,7 @@ var Rive = /** @class */ (function () {
5461
5475
  Rive.prototype.removeRiveListeners = function () {
5462
5476
  if (this.eventCleanup) {
5463
5477
  this.eventCleanup();
5478
+ this.eventCleanup = null;
5464
5479
  }
5465
5480
  };
5466
5481
  /**
@@ -5765,9 +5780,11 @@ var Rive = /** @class */ (function () {
5765
5780
  if (this._observed !== null) {
5766
5781
  observers.remove(this._observed);
5767
5782
  }
5783
+ this.removeRiveListeners();
5768
5784
  (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5769
5785
  this.riveFile = null;
5770
5786
  this.file = null;
5787
+ this.deleteRiveRenderer();
5771
5788
  };
5772
5789
  /**
5773
5790
  * Cleans up the Renderer object. Only call this API if you no longer