@rive-app/canvas-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/canvas-single",
3
- "version": "2.24.0",
3
+ "version": "2.24.1",
4
4
  "description": "Rive's high-level canvas based web api all in one js file.",
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
@@ -3354,7 +3354,7 @@ Xd();
3354
3354
  /* 2 */
3355
3355
  /***/ ((module) => {
3356
3356
 
3357
- module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"2.24.0","description":"Rive\'s high-level canvas based web api all in one js file.","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}}');
3357
+ module.exports = JSON.parse('{"name":"@rive-app/canvas-single","version":"2.24.1","description":"Rive\'s high-level canvas based web api all in one js file.","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}}');
3358
3358
 
3359
3359
  /***/ }),
3360
3360
  /* 3 */
@@ -4148,6 +4148,12 @@ var StateMachineInput = /** @class */ (function () {
4148
4148
  this.runtimeInput.fire();
4149
4149
  }
4150
4150
  };
4151
+ /**
4152
+ * Deletes the input
4153
+ */
4154
+ StateMachineInput.prototype.delete = function () {
4155
+ this.runtimeInput = null;
4156
+ };
4151
4157
  return StateMachineInput;
4152
4158
  }());
4153
4159
 
@@ -4249,6 +4255,10 @@ var StateMachine = /** @class */ (function () {
4249
4255
  * state machine is no more.
4250
4256
  */
4251
4257
  StateMachine.prototype.cleanup = function () {
4258
+ this.inputs.forEach(function (input) {
4259
+ input.delete();
4260
+ });
4261
+ this.inputs.length = 0;
4252
4262
  this.instance.delete();
4253
4263
  };
4254
4264
  return StateMachine;
@@ -5093,6 +5103,8 @@ var Rive = /** @class */ (function () {
5093
5103
  var _a;
5094
5104
  // Tracks if a Rive file is loaded
5095
5105
  this.loaded = false;
5106
+ // Reference of an object that handles any observers for the animation
5107
+ this._observed = null;
5096
5108
  /**
5097
5109
  * Tracks if a Rive file is loaded; we need this in addition to loaded as some
5098
5110
  * commands (e.g. contents) can be called as soon as the file is loaded.
@@ -5234,6 +5246,8 @@ var Rive = /** @class */ (function () {
5234
5246
  RuntimeLoader.awaitInstance()
5235
5247
  .then(function (runtime) {
5236
5248
  _this.runtime = runtime;
5249
+ _this.removeRiveListeners();
5250
+ _this.deleteRiveRenderer();
5237
5251
  // Get the canvas where you want to render the animation and create a renderer
5238
5252
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
5239
5253
  // Initial size adjustment based on devicePixelRatio if no width/height are
@@ -5288,6 +5302,7 @@ var Rive = /** @class */ (function () {
5288
5302
  Rive.prototype.removeRiveListeners = function () {
5289
5303
  if (this.eventCleanup) {
5290
5304
  this.eventCleanup();
5305
+ this.eventCleanup = null;
5291
5306
  }
5292
5307
  };
5293
5308
  /**
@@ -5592,9 +5607,11 @@ var Rive = /** @class */ (function () {
5592
5607
  if (this._observed !== null) {
5593
5608
  observers.remove(this._observed);
5594
5609
  }
5610
+ this.removeRiveListeners();
5595
5611
  (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5596
5612
  this.riveFile = null;
5597
5613
  this.file = null;
5614
+ this.deleteRiveRenderer();
5598
5615
  };
5599
5616
  /**
5600
5617
  * Cleans up the Renderer object. Only call this API if you no longer