@rive-app/webgl-single 2.27.5 → 2.28.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/webgl-single",
3
- "version": "2.27.5",
3
+ "version": "2.28.0",
4
4
  "description": "Rive's webgl based web api with bundled wasm.",
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
@@ -4054,7 +4054,7 @@ Ge();
4054
4054
  /* 2 */
4055
4055
  /***/ ((module) => {
4056
4056
 
4057
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl-single","version":"2.27.5","description":"Rive\'s webgl based web api with bundled wasm.","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}}');
4057
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl-single","version":"2.28.0","description":"Rive\'s webgl based web api with bundled wasm.","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}}');
4058
4058
 
4059
4059
  /***/ }),
4060
4060
  /* 3 */
@@ -6051,11 +6051,7 @@ var RiveFile = /** @class */ (function () {
6051
6051
  });
6052
6052
  }
6053
6053
  else {
6054
- this.eventManager.fire({
6055
- type: EventType.LoadError,
6056
- data: null,
6057
- });
6058
- throw new Error(RiveFile.fileLoadErrorMessage);
6054
+ this.fireLoadError(RiveFile.fileLoadErrorMessage);
6059
6055
  }
6060
6056
  return [2 /*return*/];
6061
6057
  }
@@ -6064,29 +6060,45 @@ var RiveFile = /** @class */ (function () {
6064
6060
  };
6065
6061
  RiveFile.prototype.init = function () {
6066
6062
  return __awaiter(this, void 0, void 0, function () {
6067
- var _a;
6063
+ var _a, error_1;
6068
6064
  return __generator(this, function (_b) {
6069
6065
  switch (_b.label) {
6070
6066
  case 0:
6071
6067
  // If no source file url specified, it's a bust
6072
6068
  if (!this.src && !this.buffer) {
6073
- throw new Error(RiveFile.missingErrorMessage);
6069
+ this.fireLoadError(RiveFile.missingErrorMessage);
6070
+ return [2 /*return*/];
6074
6071
  }
6072
+ _b.label = 1;
6073
+ case 1:
6074
+ _b.trys.push([1, 4, , 5]);
6075
6075
  _a = this;
6076
6076
  return [4 /*yield*/, RuntimeLoader.awaitInstance()];
6077
- case 1:
6077
+ case 2:
6078
6078
  _a.runtime = _b.sent();
6079
6079
  if (this.destroyed) {
6080
6080
  return [2 /*return*/];
6081
6081
  }
6082
6082
  return [4 /*yield*/, this.initData()];
6083
- case 2:
6083
+ case 3:
6084
6084
  _b.sent();
6085
- return [2 /*return*/];
6085
+ return [3 /*break*/, 5];
6086
+ case 4:
6087
+ error_1 = _b.sent();
6088
+ this.fireLoadError(error_1 instanceof Error ? error_1.message : RiveFile.fileLoadErrorMessage);
6089
+ return [3 /*break*/, 5];
6090
+ case 5: return [2 /*return*/];
6086
6091
  }
6087
6092
  });
6088
6093
  });
6089
6094
  };
6095
+ RiveFile.prototype.fireLoadError = function (message) {
6096
+ this.eventManager.fire({
6097
+ type: EventType.LoadError,
6098
+ data: message,
6099
+ });
6100
+ throw new Error(message);
6101
+ };
6090
6102
  /**
6091
6103
  * Subscribe to Rive-generated events
6092
6104
  * @param type the type of event to subscribe to
@@ -6417,7 +6429,7 @@ var Rive = /** @class */ (function () {
6417
6429
  // Returns true for successful initialization.
6418
6430
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
6419
6431
  return __awaiter(this, void 0, void 0, function () {
6420
- var error_1, msg;
6432
+ var error_2, msg;
6421
6433
  var _a;
6422
6434
  return __generator(this, function (_b) {
6423
6435
  switch (_b.label) {
@@ -6459,8 +6471,8 @@ var Rive = /** @class */ (function () {
6459
6471
  this.drawFrame();
6460
6472
  return [2 /*return*/, true];
6461
6473
  case 3:
6462
- error_1 = _b.sent();
6463
- msg = resolveErrorMessage(error_1);
6474
+ error_2 = _b.sent();
6475
+ msg = resolveErrorMessage(error_2);
6464
6476
  console.warn(msg);
6465
6477
  this.eventManager.fire({ type: EventType.LoadError, data: msg });
6466
6478
  return [2 /*return*/, Promise.reject(msg)];