@rive-app/canvas 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/canvas",
3
- "version": "2.24.0",
3
+ "version": "2.24.1",
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
@@ -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
@@ -3365,7 +3365,7 @@ $d();
3365
3365
  /* 2 */
3366
3366
  /***/ ((module) => {
3367
3367
 
3368
- module.exports = JSON.parse('{"name":"@rive-app/canvas","version":"2.24.0","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 = JSON.parse('{"name":"@rive-app/canvas","version":"2.24.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}}');
3369
3369
 
3370
3370
  /***/ }),
3371
3371
  /* 3 */
@@ -4159,6 +4159,12 @@ var StateMachineInput = /** @class */ (function () {
4159
4159
  this.runtimeInput.fire();
4160
4160
  }
4161
4161
  };
4162
+ /**
4163
+ * Deletes the input
4164
+ */
4165
+ StateMachineInput.prototype.delete = function () {
4166
+ this.runtimeInput = null;
4167
+ };
4162
4168
  return StateMachineInput;
4163
4169
  }());
4164
4170
 
@@ -4260,6 +4266,10 @@ var StateMachine = /** @class */ (function () {
4260
4266
  * state machine is no more.
4261
4267
  */
4262
4268
  StateMachine.prototype.cleanup = function () {
4269
+ this.inputs.forEach(function (input) {
4270
+ input.delete();
4271
+ });
4272
+ this.inputs.length = 0;
4263
4273
  this.instance.delete();
4264
4274
  };
4265
4275
  return StateMachine;
@@ -5104,6 +5114,8 @@ var Rive = /** @class */ (function () {
5104
5114
  var _a;
5105
5115
  // Tracks if a Rive file is loaded
5106
5116
  this.loaded = false;
5117
+ // Reference of an object that handles any observers for the animation
5118
+ this._observed = null;
5107
5119
  /**
5108
5120
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
5109
5121
  * commands (e.g. contents) can be called as soon as the file is loaded.
@@ -5245,6 +5257,8 @@ var Rive = /** @class */ (function () {
5245
5257
  RuntimeLoader.awaitInstance()
5246
5258
  .then(function (runtime) {
5247
5259
  _this.runtime = runtime;
5260
+ _this.removeRiveListeners();
5261
+ _this.deleteRiveRenderer();
5248
5262
  // Get the canvas where you want to render the animation and create a renderer
5249
5263
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
5250
5264
  // Initial size adjustment based on devicePixelRatio if no width/height are
@@ -5299,6 +5313,7 @@ var Rive = /** @class */ (function () {
5299
5313
  Rive.prototype.removeRiveListeners = function () {
5300
5314
  if (this.eventCleanup) {
5301
5315
  this.eventCleanup();
5316
+ this.eventCleanup = null;
5302
5317
  }
5303
5318
  };
5304
5319
  /**
@@ -5603,9 +5618,11 @@ var Rive = /** @class */ (function () {
5603
5618
  if (this._observed !== null) {
5604
5619
  observers.remove(this._observed);
5605
5620
  }
5621
+ this.removeRiveListeners();
5606
5622
  (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5607
5623
  this.riveFile = null;
5608
5624
  this.file = null;
5625
+ this.deleteRiveRenderer();
5609
5626
  };
5610
5627
  /**
5611
5628
  * Cleans up the Renderer object. Only call this API if you no longer