@rive-app/webgl-single 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/webgl-single",
3
- "version": "2.24.0",
3
+ "version": "2.24.1",
4
4
  "description": "Rive's webgl based web api with bundled wasm.",
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
@@ -4050,7 +4050,7 @@ Ge();
4050
4050
  /* 2 */
4051
4051
  /***/ ((module) => {
4052
4052
 
4053
- module.exports = JSON.parse('{"name":"@rive-app/webgl-single","version":"2.24.0","description":"Rive\'s webgl based web api with bundled wasm.","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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4053
+ module.exports = JSON.parse('{"name":"@rive-app/webgl-single","version":"2.24.1","description":"Rive\'s webgl based web api with bundled wasm.","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.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
4054
4054
 
4055
4055
  /***/ }),
4056
4056
  /* 3 */
@@ -4844,6 +4844,12 @@ var StateMachineInput = /** @class */ (function () {
4844
4844
  this.runtimeInput.fire();
4845
4845
  }
4846
4846
  };
4847
+ /**
4848
+ * Deletes the input
4849
+ */
4850
+ StateMachineInput.prototype.delete = function () {
4851
+ this.runtimeInput = null;
4852
+ };
4847
4853
  return StateMachineInput;
4848
4854
  }());
4849
4855
 
@@ -4945,6 +4951,10 @@ var StateMachine = /** @class */ (function () {
4945
4951
  * state machine is no more.
4946
4952
  */
4947
4953
  StateMachine.prototype.cleanup = function () {
4954
+ this.inputs.forEach(function (input) {
4955
+ input.delete();
4956
+ });
4957
+ this.inputs.length = 0;
4948
4958
  this.instance.delete();
4949
4959
  };
4950
4960
  return StateMachine;
@@ -5789,6 +5799,8 @@ var Rive = /** @class */ (function () {
5789
5799
  var _a;
5790
5800
  // Tracks if a Rive file is loaded
5791
5801
  this.loaded = false;
5802
+ // Reference of an object that handles any observers for the animation
5803
+ this._observed = null;
5792
5804
  /**
5793
5805
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
5794
5806
  * commands (e.g. contents) can be called as soon as the file is loaded.
@@ -5930,6 +5942,8 @@ var Rive = /** @class */ (function () {
5930
5942
  RuntimeLoader.awaitInstance()
5931
5943
  .then(function (runtime) {
5932
5944
  _this.runtime = runtime;
5945
+ _this.removeRiveListeners();
5946
+ _this.deleteRiveRenderer();
5933
5947
  // Get the canvas where you want to render the animation and create a renderer
5934
5948
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
5935
5949
  // Initial size adjustment based on devicePixelRatio if no width/height are
@@ -5984,6 +5998,7 @@ var Rive = /** @class */ (function () {
5984
5998
  Rive.prototype.removeRiveListeners = function () {
5985
5999
  if (this.eventCleanup) {
5986
6000
  this.eventCleanup();
6001
+ this.eventCleanup = null;
5987
6002
  }
5988
6003
  };
5989
6004
  /**
@@ -6288,9 +6303,11 @@ var Rive = /** @class */ (function () {
6288
6303
  if (this._observed !== null) {
6289
6304
  observers.remove(this._observed);
6290
6305
  }
6306
+ this.removeRiveListeners();
6291
6307
  (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
6292
6308
  this.riveFile = null;
6293
6309
  this.file = null;
6310
+ this.deleteRiveRenderer();
6294
6311
  };
6295
6312
  /**
6296
6313
  * Cleans up the Renderer object. Only call this API if you no longer