@rive-app/canvas-lite 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 +1 -1
- package/rive.d.ts +1 -0
- package/rive.js +26 -14
- package/rive.js.map +1 -1
package/package.json
CHANGED
package/rive.d.ts
CHANGED
package/rive.js
CHANGED
|
@@ -2271,7 +2271,7 @@ Qc();
|
|
|
2271
2271
|
/* 2 */
|
|
2272
2272
|
/***/ ((module) => {
|
|
2273
2273
|
|
|
2274
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
2274
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.28.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}}');
|
|
2275
2275
|
|
|
2276
2276
|
/***/ }),
|
|
2277
2277
|
/* 3 */
|
|
@@ -4268,11 +4268,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
4268
4268
|
});
|
|
4269
4269
|
}
|
|
4270
4270
|
else {
|
|
4271
|
-
this.
|
|
4272
|
-
type: EventType.LoadError,
|
|
4273
|
-
data: null,
|
|
4274
|
-
});
|
|
4275
|
-
throw new Error(RiveFile.fileLoadErrorMessage);
|
|
4271
|
+
this.fireLoadError(RiveFile.fileLoadErrorMessage);
|
|
4276
4272
|
}
|
|
4277
4273
|
return [2 /*return*/];
|
|
4278
4274
|
}
|
|
@@ -4281,29 +4277,45 @@ var RiveFile = /** @class */ (function () {
|
|
|
4281
4277
|
};
|
|
4282
4278
|
RiveFile.prototype.init = function () {
|
|
4283
4279
|
return __awaiter(this, void 0, void 0, function () {
|
|
4284
|
-
var _a;
|
|
4280
|
+
var _a, error_1;
|
|
4285
4281
|
return __generator(this, function (_b) {
|
|
4286
4282
|
switch (_b.label) {
|
|
4287
4283
|
case 0:
|
|
4288
4284
|
// If no source file url specified, it's a bust
|
|
4289
4285
|
if (!this.src && !this.buffer) {
|
|
4290
|
-
|
|
4286
|
+
this.fireLoadError(RiveFile.missingErrorMessage);
|
|
4287
|
+
return [2 /*return*/];
|
|
4291
4288
|
}
|
|
4289
|
+
_b.label = 1;
|
|
4290
|
+
case 1:
|
|
4291
|
+
_b.trys.push([1, 4, , 5]);
|
|
4292
4292
|
_a = this;
|
|
4293
4293
|
return [4 /*yield*/, RuntimeLoader.awaitInstance()];
|
|
4294
|
-
case
|
|
4294
|
+
case 2:
|
|
4295
4295
|
_a.runtime = _b.sent();
|
|
4296
4296
|
if (this.destroyed) {
|
|
4297
4297
|
return [2 /*return*/];
|
|
4298
4298
|
}
|
|
4299
4299
|
return [4 /*yield*/, this.initData()];
|
|
4300
|
-
case
|
|
4300
|
+
case 3:
|
|
4301
4301
|
_b.sent();
|
|
4302
|
-
return [
|
|
4302
|
+
return [3 /*break*/, 5];
|
|
4303
|
+
case 4:
|
|
4304
|
+
error_1 = _b.sent();
|
|
4305
|
+
this.fireLoadError(error_1 instanceof Error ? error_1.message : RiveFile.fileLoadErrorMessage);
|
|
4306
|
+
return [3 /*break*/, 5];
|
|
4307
|
+
case 5: return [2 /*return*/];
|
|
4303
4308
|
}
|
|
4304
4309
|
});
|
|
4305
4310
|
});
|
|
4306
4311
|
};
|
|
4312
|
+
RiveFile.prototype.fireLoadError = function (message) {
|
|
4313
|
+
this.eventManager.fire({
|
|
4314
|
+
type: EventType.LoadError,
|
|
4315
|
+
data: message,
|
|
4316
|
+
});
|
|
4317
|
+
throw new Error(message);
|
|
4318
|
+
};
|
|
4307
4319
|
/**
|
|
4308
4320
|
* Subscribe to Rive-generated events
|
|
4309
4321
|
* @param type the type of event to subscribe to
|
|
@@ -4634,7 +4646,7 @@ var Rive = /** @class */ (function () {
|
|
|
4634
4646
|
// Returns true for successful initialization.
|
|
4635
4647
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
4636
4648
|
return __awaiter(this, void 0, void 0, function () {
|
|
4637
|
-
var
|
|
4649
|
+
var error_2, msg;
|
|
4638
4650
|
var _a;
|
|
4639
4651
|
return __generator(this, function (_b) {
|
|
4640
4652
|
switch (_b.label) {
|
|
@@ -4676,8 +4688,8 @@ var Rive = /** @class */ (function () {
|
|
|
4676
4688
|
this.drawFrame();
|
|
4677
4689
|
return [2 /*return*/, true];
|
|
4678
4690
|
case 3:
|
|
4679
|
-
|
|
4680
|
-
msg = resolveErrorMessage(
|
|
4691
|
+
error_2 = _b.sent();
|
|
4692
|
+
msg = resolveErrorMessage(error_2);
|
|
4681
4693
|
console.warn(msg);
|
|
4682
4694
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
4683
4695
|
return [2 /*return*/, Promise.reject(msg)];
|