@rive-app/webgl2 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/webgl2",
3
- "version": "2.27.5",
3
+ "version": "2.29.0",
4
4
  "description": "Rive's webgl2 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
@@ -442,7 +442,7 @@ function Oa(a, b) {
442
442
  return Na(c, a, b);
443
443
  }));
444
444
  }
445
- var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
445
+ var Pa, Qa, Ua = {518071:(a, b, c, d, e) => {
446
446
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
447
447
  return 0;
448
448
  }
@@ -505,11 +505,11 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
505
505
  }
506
506
  window.h.Da += 1;
507
507
  return 1;
508
- }, 520073:() => {
508
+ }, 520249:() => {
509
509
  "undefined" !== typeof window.h && (window.h.Va.map(function(a) {
510
510
  document.removeEventListener(a, window.h.unlock, !0);
511
511
  }), --window.h.Da, 0 === window.h.Da && delete window.h);
512
- }, 520377:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 520481:() => {
512
+ }, 520553:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 520657:() => {
513
513
  try {
514
514
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
515
515
  a.close();
@@ -517,7 +517,7 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
517
517
  } catch (c) {
518
518
  return 0;
519
519
  }
520
- }, 520652:(a, b, c, d, e, f) => {
520
+ }, 520828:(a, b, c, d, e, f) => {
521
521
  if ("undefined" === typeof window.h) {
522
522
  return -1;
523
523
  }
@@ -563,7 +563,7 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
563
563
  a == window.h.I.Ba && g.Z.connect(g.J.destination);
564
564
  g.mb = f;
565
565
  return window.h.oc(g);
566
- }, 523529:a => window.h.va(a).J.sampleRate, 523602:a => {
566
+ }, 523705:a => window.h.va(a).J.sampleRate, 523778:a => {
567
567
  a = window.h.va(a);
568
568
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
569
569
  }, a.Z.disconnect(), a.Z = void 0);
@@ -571,13 +571,13 @@ var Pa, Qa, Ua = {517895:(a, b, c, d, e) => {
571
571
  a.J.close();
572
572
  a.J = void 0;
573
573
  a.mb = void 0;
574
- }, 524002:a => {
574
+ }, 524178:a => {
575
575
  window.h.yb(a);
576
- }, 524052:a => {
576
+ }, 524228:a => {
577
577
  a = window.h.va(a);
578
578
  a.J.resume();
579
579
  a.state = window.h.ja.ub;
580
- }, 524191:a => {
580
+ }, 524367:a => {
581
581
  a = window.h.va(a);
582
582
  a.J.suspend();
583
583
  a.state = window.h.ja.stopped;
@@ -3501,8 +3501,8 @@ k.dynCall_viijii = (a, b, c, d, e, f, g) => (k.dynCall_viijii = C.dynCall_viijii
3501
3501
  k.dynCall_iiiiij = (a, b, c, d, e, f, g) => (k.dynCall_iiiiij = C.dynCall_iiiiij)(a, b, c, d, e, f, g);
3502
3502
  k.dynCall_iiiiijj = (a, b, c, d, e, f, g, l, p) => (k.dynCall_iiiiijj = C.dynCall_iiiiijj)(a, b, c, d, e, f, g, l, p);
3503
3503
  k.dynCall_iiiiiijj = (a, b, c, d, e, f, g, l, p, m) => (k.dynCall_iiiiiijj = C.dynCall_iiiiiijj)(a, b, c, d, e, f, g, l, p, m);
3504
- k.___start_em_js = 515140;
3505
- k.___stop_em_js = 517895;
3504
+ k.___start_em_js = 515316;
3505
+ k.___stop_em_js = 518071;
3506
3506
  var Zd;
3507
3507
  Ha = function $d() {
3508
3508
  Zd || ae();
@@ -3562,7 +3562,7 @@ ae();
3562
3562
  /* 2 */
3563
3563
  /***/ ((module) => {
3564
3564
 
3565
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.27.5","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3565
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.29.0","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3566
3566
 
3567
3567
  /***/ }),
3568
3568
  /* 3 */
@@ -5559,11 +5559,7 @@ var RiveFile = /** @class */ (function () {
5559
5559
  });
5560
5560
  }
5561
5561
  else {
5562
- this.eventManager.fire({
5563
- type: EventType.LoadError,
5564
- data: null,
5565
- });
5566
- throw new Error(RiveFile.fileLoadErrorMessage);
5562
+ this.fireLoadError(RiveFile.fileLoadErrorMessage);
5567
5563
  }
5568
5564
  return [2 /*return*/];
5569
5565
  }
@@ -5572,29 +5568,45 @@ var RiveFile = /** @class */ (function () {
5572
5568
  };
5573
5569
  RiveFile.prototype.init = function () {
5574
5570
  return __awaiter(this, void 0, void 0, function () {
5575
- var _a;
5571
+ var _a, error_1;
5576
5572
  return __generator(this, function (_b) {
5577
5573
  switch (_b.label) {
5578
5574
  case 0:
5579
5575
  // If no source file url specified, it's a bust
5580
5576
  if (!this.src && !this.buffer) {
5581
- throw new Error(RiveFile.missingErrorMessage);
5577
+ this.fireLoadError(RiveFile.missingErrorMessage);
5578
+ return [2 /*return*/];
5582
5579
  }
5580
+ _b.label = 1;
5581
+ case 1:
5582
+ _b.trys.push([1, 4, , 5]);
5583
5583
  _a = this;
5584
5584
  return [4 /*yield*/, RuntimeLoader.awaitInstance()];
5585
- case 1:
5585
+ case 2:
5586
5586
  _a.runtime = _b.sent();
5587
5587
  if (this.destroyed) {
5588
5588
  return [2 /*return*/];
5589
5589
  }
5590
5590
  return [4 /*yield*/, this.initData()];
5591
- case 2:
5591
+ case 3:
5592
5592
  _b.sent();
5593
- return [2 /*return*/];
5593
+ return [3 /*break*/, 5];
5594
+ case 4:
5595
+ error_1 = _b.sent();
5596
+ this.fireLoadError(error_1 instanceof Error ? error_1.message : RiveFile.fileLoadErrorMessage);
5597
+ return [3 /*break*/, 5];
5598
+ case 5: return [2 /*return*/];
5594
5599
  }
5595
5600
  });
5596
5601
  });
5597
5602
  };
5603
+ RiveFile.prototype.fireLoadError = function (message) {
5604
+ this.eventManager.fire({
5605
+ type: EventType.LoadError,
5606
+ data: message,
5607
+ });
5608
+ throw new Error(message);
5609
+ };
5598
5610
  /**
5599
5611
  * Subscribe to Rive-generated events
5600
5612
  * @param type the type of event to subscribe to
@@ -5925,7 +5937,7 @@ var Rive = /** @class */ (function () {
5925
5937
  // Returns true for successful initialization.
5926
5938
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
5927
5939
  return __awaiter(this, void 0, void 0, function () {
5928
- var error_1, msg;
5940
+ var error_2, msg;
5929
5941
  var _a;
5930
5942
  return __generator(this, function (_b) {
5931
5943
  switch (_b.label) {
@@ -5967,8 +5979,8 @@ var Rive = /** @class */ (function () {
5967
5979
  this.drawFrame();
5968
5980
  return [2 /*return*/, true];
5969
5981
  case 3:
5970
- error_1 = _b.sent();
5971
- msg = resolveErrorMessage(error_1);
5982
+ error_2 = _b.sent();
5983
+ msg = resolveErrorMessage(error_2);
5972
5984
  console.warn(msg);
5973
5985
  this.eventManager.fire({ type: EventType.LoadError, data: msg });
5974
5986
  return [2 /*return*/, Promise.reject(msg)];