@rive-app/canvas-lite 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-lite",
3
- "version": "2.24.0",
3
+ "version": "2.24.1",
4
4
  "description": "A lite version of 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
@@ -2269,7 +2269,7 @@ Qc();
2269
2269
  /* 2 */
2270
2270
  /***/ ((module) => {
2271
2271
 
2272
- module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.24.0","description":"A lite version of 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}}');
2272
+ module.exports = JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.24.1","description":"A lite version of 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}}');
2273
2273
 
2274
2274
  /***/ }),
2275
2275
  /* 3 */
@@ -3063,6 +3063,12 @@ var StateMachineInput = /** @class */ (function () {
3063
3063
  this.runtimeInput.fire();
3064
3064
  }
3065
3065
  };
3066
+ /**
3067
+ * Deletes the input
3068
+ */
3069
+ StateMachineInput.prototype.delete = function () {
3070
+ this.runtimeInput = null;
3071
+ };
3066
3072
  return StateMachineInput;
3067
3073
  }());
3068
3074
 
@@ -3164,6 +3170,10 @@ var StateMachine = /** @class */ (function () {
3164
3170
  * state machine is no more.
3165
3171
  */
3166
3172
  StateMachine.prototype.cleanup = function () {
3173
+ this.inputs.forEach(function (input) {
3174
+ input.delete();
3175
+ });
3176
+ this.inputs.length = 0;
3167
3177
  this.instance.delete();
3168
3178
  };
3169
3179
  return StateMachine;
@@ -4008,6 +4018,8 @@ var Rive = /** @class */ (function () {
4008
4018
  var _a;
4009
4019
  // Tracks if a Rive file is loaded
4010
4020
  this.loaded = false;
4021
+ // Reference of an object that handles any observers for the animation
4022
+ this._observed = null;
4011
4023
  /**
4012
4024
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
4013
4025
  * commands (e.g. contents) can be called as soon as the file is loaded.
@@ -4149,6 +4161,8 @@ var Rive = /** @class */ (function () {
4149
4161
  RuntimeLoader.awaitInstance()
4150
4162
  .then(function (runtime) {
4151
4163
  _this.runtime = runtime;
4164
+ _this.removeRiveListeners();
4165
+ _this.deleteRiveRenderer();
4152
4166
  // Get the canvas where you want to render the animation and create a renderer
4153
4167
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
4154
4168
  // Initial size adjustment based on devicePixelRatio if no width/height are
@@ -4203,6 +4217,7 @@ var Rive = /** @class */ (function () {
4203
4217
  Rive.prototype.removeRiveListeners = function () {
4204
4218
  if (this.eventCleanup) {
4205
4219
  this.eventCleanup();
4220
+ this.eventCleanup = null;
4206
4221
  }
4207
4222
  };
4208
4223
  /**
@@ -4507,9 +4522,11 @@ var Rive = /** @class */ (function () {
4507
4522
  if (this._observed !== null) {
4508
4523
  observers.remove(this._observed);
4509
4524
  }
4525
+ this.removeRiveListeners();
4510
4526
  (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
4511
4527
  this.riveFile = null;
4512
4528
  this.file = null;
4529
+ this.deleteRiveRenderer();
4513
4530
  };
4514
4531
  /**
4515
4532
  * Cleans up the Renderer object. Only call this API if you no longer