@rive-app/canvas 2.27.5 → 2.29.0

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.27.5",
3
+ "version": "2.29.0",
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
@@ -317,6 +317,7 @@ export declare class RiveFile {
317
317
  constructor(params: RiveFileParameters);
318
318
  private initData;
319
319
  init(): Promise<void>;
320
+ private fireLoadError;
320
321
  /**
321
322
  * Subscribe to Rive-generated events
322
323
  * @param type the type of event to subscribe to
package/rive.js CHANGED
@@ -746,7 +746,7 @@ function Ya(a, b) {
746
746
  return Xa(c, a, b);
747
747
  }));
748
748
  }
749
- var Za, $a, db = {453404:(a, b, c, d, e) => {
749
+ var Za, $a, db = {453532:(a, b, c, d, e) => {
750
750
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
751
751
  return 0;
752
752
  }
@@ -809,11 +809,11 @@ var Za, $a, db = {453404:(a, b, c, d, e) => {
809
809
  }
810
810
  window.h.Aa += 1;
811
811
  return 1;
812
- }, 455582:() => {
812
+ }, 455710:() => {
813
813
  "undefined" !== typeof window.h && (window.h.Ta.map(function(a) {
814
814
  document.removeEventListener(a, window.h.unlock, !0);
815
815
  }), --window.h.Aa, 0 === window.h.Aa && delete window.h);
816
- }, 455886:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 455990:() => {
816
+ }, 456014:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 456118:() => {
817
817
  try {
818
818
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
819
819
  a.close();
@@ -821,7 +821,7 @@ var Za, $a, db = {453404:(a, b, c, d, e) => {
821
821
  } catch (c) {
822
822
  return 0;
823
823
  }
824
- }, 456161:(a, b, c, d, e, f) => {
824
+ }, 456289:(a, b, c, d, e, f) => {
825
825
  if ("undefined" === typeof window.h) {
826
826
  return -1;
827
827
  }
@@ -867,7 +867,7 @@ var Za, $a, db = {453404:(a, b, c, d, e) => {
867
867
  a == window.h.I.ya && g.Z.connect(g.J.destination);
868
868
  g.qb = f;
869
869
  return window.h.yc(g);
870
- }, 459038:a => window.h.ra(a).J.sampleRate, 459111:a => {
870
+ }, 459166:a => window.h.ra(a).J.sampleRate, 459239:a => {
871
871
  a = window.h.ra(a);
872
872
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
873
873
  }, a.Z.disconnect(), a.Z = void 0);
@@ -875,13 +875,13 @@ var Za, $a, db = {453404:(a, b, c, d, e) => {
875
875
  a.J.close();
876
876
  a.J = void 0;
877
877
  a.qb = void 0;
878
- }, 459511:a => {
878
+ }, 459639:a => {
879
879
  window.h.Cb(a);
880
- }, 459561:a => {
880
+ }, 459689:a => {
881
881
  a = window.h.ra(a);
882
882
  a.J.resume();
883
883
  a.state = window.h.ga.yb;
884
- }, 459700:a => {
884
+ }, 459828:a => {
885
885
  a = window.h.ra(a);
886
886
  a.J.suspend();
887
887
  a.state = window.h.ga.stopped;
@@ -3369,7 +3369,7 @@ $d();
3369
3369
  /* 2 */
3370
3370
  /***/ ((module) => {
3371
3371
 
3372
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.27.5","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}}');
3372
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.29.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}}');
3373
3373
 
3374
3374
  /***/ }),
3375
3375
  /* 3 */
@@ -5366,11 +5366,7 @@ var RiveFile = /** @class */ (function () {
5366
5366
  });
5367
5367
  }
5368
5368
  else {
5369
- this.eventManager.fire({
5370
- type: EventType.LoadError,
5371
- data: null,
5372
- });
5373
- throw new Error(RiveFile.fileLoadErrorMessage);
5369
+ this.fireLoadError(RiveFile.fileLoadErrorMessage);
5374
5370
  }
5375
5371
  return [2 /*return*/];
5376
5372
  }
@@ -5379,29 +5375,45 @@ var RiveFile = /** @class */ (function () {
5379
5375
  };
5380
5376
  RiveFile.prototype.init = function () {
5381
5377
  return __awaiter(this, void 0, void 0, function () {
5382
- var _a;
5378
+ var _a, error_1;
5383
5379
  return __generator(this, function (_b) {
5384
5380
  switch (_b.label) {
5385
5381
  case 0:
5386
5382
  // If no source file url specified, it's a bust
5387
5383
  if (!this.src && !this.buffer) {
5388
- throw new Error(RiveFile.missingErrorMessage);
5384
+ this.fireLoadError(RiveFile.missingErrorMessage);
5385
+ return [2 /*return*/];
5389
5386
  }
5387
+ _b.label = 1;
5388
+ case 1:
5389
+ _b.trys.push([1, 4, , 5]);
5390
5390
  _a = this;
5391
5391
  return [4 /*yield*/, RuntimeLoader.awaitInstance()];
5392
- case 1:
5392
+ case 2:
5393
5393
  _a.runtime = _b.sent();
5394
5394
  if (this.destroyed) {
5395
5395
  return [2 /*return*/];
5396
5396
  }
5397
5397
  return [4 /*yield*/, this.initData()];
5398
- case 2:
5398
+ case 3:
5399
5399
  _b.sent();
5400
- return [2 /*return*/];
5400
+ return [3 /*break*/, 5];
5401
+ case 4:
5402
+ error_1 = _b.sent();
5403
+ this.fireLoadError(error_1 instanceof Error ? error_1.message : RiveFile.fileLoadErrorMessage);
5404
+ return [3 /*break*/, 5];
5405
+ case 5: return [2 /*return*/];
5401
5406
  }
5402
5407
  });
5403
5408
  });
5404
5409
  };
5410
+ RiveFile.prototype.fireLoadError = function (message) {
5411
+ this.eventManager.fire({
5412
+ type: EventType.LoadError,
5413
+ data: message,
5414
+ });
5415
+ throw new Error(message);
5416
+ };
5405
5417
  /**
5406
5418
  * Subscribe to Rive-generated events
5407
5419
  * @param type the type of event to subscribe to
@@ -5732,7 +5744,7 @@ var Rive = /** @class */ (function () {
5732
5744
  // Returns true for successful initialization.
5733
5745
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
5734
5746
  return __awaiter(this, void 0, void 0, function () {
5735
- var error_1, msg;
5747
+ var error_2, msg;
5736
5748
  var _a;
5737
5749
  return __generator(this, function (_b) {
5738
5750
  switch (_b.label) {
@@ -5774,8 +5786,8 @@ var Rive = /** @class */ (function () {
5774
5786
  this.drawFrame();
5775
5787
  return [2 /*return*/, true];
5776
5788
  case 3:
5777
- error_1 = _b.sent();
5778
- msg = resolveErrorMessage(error_1);
5789
+ error_2 = _b.sent();
5790
+ msg = resolveErrorMessage(error_2);
5779
5791
  console.warn(msg);
5780
5792
  this.eventManager.fire({ type: EventType.LoadError, data: msg });
5781
5793
  return [2 /*return*/, Promise.reject(msg)];