@rive-app/webgl2 2.15.5 → 2.16.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.15.5",
3
+ "version": "2.16.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
@@ -123,7 +123,7 @@ export declare enum EventType {
123
123
  export type RiveEventPayload = rc.RiveEvent | rc.OpenUrlEvent;
124
124
  export interface Event {
125
125
  type: EventType;
126
- data?: string | string[] | LoopEvent | number | RiveEventPayload;
126
+ data?: string | string[] | LoopEvent | number | RiveEventPayload | RiveFile;
127
127
  }
128
128
  /**
129
129
  * Looping types: one-shot, loop, and ping-pong
@@ -189,6 +189,7 @@ export interface RiveParameters {
189
189
  canvas: HTMLCanvasElement | OffscreenCanvas;
190
190
  src?: string;
191
191
  buffer?: ArrayBuffer;
192
+ riveFile?: RiveFile;
192
193
  artboard?: string;
193
194
  animations?: string | string[];
194
195
  stateMachines?: string | string[];
@@ -265,6 +266,7 @@ export interface RiveParameters {
265
266
  export interface RiveLoadParameters {
266
267
  src?: string;
267
268
  buffer?: ArrayBuffer;
269
+ riveFile?: RiveFile;
268
270
  autoplay?: boolean;
269
271
  artboard?: string;
270
272
  animations?: string | string[];
@@ -278,6 +280,50 @@ export interface RiveResetParameters {
278
280
  stateMachines?: string | string[];
279
281
  autoplay?: boolean;
280
282
  }
283
+ export interface RiveFileParameters {
284
+ src?: string;
285
+ buffer?: ArrayBuffer;
286
+ assetLoader?: AssetLoadCallback;
287
+ enableRiveAssetCDN?: boolean;
288
+ onLoad?: EventCallback;
289
+ onLoadError?: EventCallback;
290
+ }
291
+ export declare class RiveFile {
292
+ private static readonly missingErrorMessage;
293
+ private static readonly fileLoadErrorMessage;
294
+ private src;
295
+ private buffer;
296
+ private runtime;
297
+ private file;
298
+ private assetLoader;
299
+ private enableRiveAssetCDN;
300
+ private eventManager;
301
+ private referenceCount;
302
+ constructor(params: RiveFileParameters);
303
+ private initData;
304
+ init(): Promise<void>;
305
+ /**
306
+ * Subscribe to Rive-generated events
307
+ * @param type the type of event to subscribe to
308
+ * @param callback callback to fire when the event occurs
309
+ */
310
+ on(type: EventType, callback: EventCallback): void;
311
+ /**
312
+ * Unsubscribes from a Rive-generated event
313
+ * @param type the type of event to unsubscribe from
314
+ * @param callback the callback to unsubscribe
315
+ */
316
+ off(type: EventType, callback: EventCallback): void;
317
+ cleanup(): void;
318
+ /**
319
+ * Unsubscribes all Rive listeners from an event type, or everything if no type is
320
+ * given
321
+ * @param type the type of event to unsubscribe from, or all types if
322
+ * undefined
323
+ */
324
+ removeAllRiveEventListeners(type?: EventType): void;
325
+ getInstance(): rc.File;
326
+ }
281
327
  export declare class Rive {
282
328
  private readonly canvas;
283
329
  private src;
@@ -298,6 +344,7 @@ export declare class Rive {
298
344
  private artboard;
299
345
  private eventCleanup;
300
346
  private file;
347
+ private riveFile;
301
348
  private eventManager;
302
349
  private taskQueue;
303
350
  private animator;
package/rive.js CHANGED
@@ -415,7 +415,7 @@ function Na(a, b) {
415
415
  return Ma(c, a, b);
416
416
  }));
417
417
  }
418
- var Oa, Pa, Ta = {470208:(a, b, c, d, e) => {
418
+ var Oa, Pa, Ta = {470384:(a, b, c, d, e) => {
419
419
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
420
420
  return 0;
421
421
  }
@@ -478,9 +478,9 @@ var Oa, Pa, Ta = {470208:(a, b, c, d, e) => {
478
478
  }
479
479
  window.h.Da += 1;
480
480
  return 1;
481
- }, 472386:() => {
481
+ }, 472562:() => {
482
482
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
483
- }, 472550:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 472654:() => {
483
+ }, 472726:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 472830:() => {
484
484
  try {
485
485
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
486
486
  a.close();
@@ -488,7 +488,7 @@ var Oa, Pa, Ta = {470208:(a, b, c, d, e) => {
488
488
  } catch (c) {
489
489
  return 0;
490
490
  }
491
- }, 472825:(a, b, c, d, e, f) => {
491
+ }, 473001:(a, b, c, d, e, f) => {
492
492
  if ("undefined" === typeof window.h) {
493
493
  return -1;
494
494
  }
@@ -534,7 +534,7 @@ var Oa, Pa, Ta = {470208:(a, b, c, d, e) => {
534
534
  a == window.h.I.Ba && g.Y.connect(g.J.destination);
535
535
  g.jb = f;
536
536
  return window.h.lc(g);
537
- }, 475702:a => window.h.va(a).J.sampleRate, 475775:a => {
537
+ }, 475878:a => window.h.va(a).J.sampleRate, 475951:a => {
538
538
  a = window.h.va(a);
539
539
  void 0 !== a.Y && (a.Y.onaudioprocess = function() {
540
540
  }, a.Y.disconnect(), a.Y = void 0);
@@ -542,13 +542,13 @@ var Oa, Pa, Ta = {470208:(a, b, c, d, e) => {
542
542
  a.J.close();
543
543
  a.J = void 0;
544
544
  a.jb = void 0;
545
- }, 476175:a => {
545
+ }, 476351:a => {
546
546
  window.h.wb(a);
547
- }, 476225:a => {
547
+ }, 476401:a => {
548
548
  a = window.h.va(a);
549
549
  a.J.resume();
550
550
  a.state = window.h.ha.rb;
551
- }, 476364:a => {
551
+ }, 476540:a => {
552
552
  a = window.h.va(a);
553
553
  a.J.suspend();
554
554
  a.state = window.h.ha.stopped;
@@ -3459,8 +3459,8 @@ n.dynCall_viijii = (a, b, c, d, e, f, g) => (n.dynCall_viijii = B.dynCall_viijii
3459
3459
  n.dynCall_iiiiij = (a, b, c, d, e, f, g) => (n.dynCall_iiiiij = B.dynCall_iiiiij)(a, b, c, d, e, f, g);
3460
3460
  n.dynCall_iiiiijj = (a, b, c, d, e, f, g, m, p) => (n.dynCall_iiiiijj = B.dynCall_iiiiijj)(a, b, c, d, e, f, g, m, p);
3461
3461
  n.dynCall_iiiiiijj = (a, b, c, d, e, f, g, m, p, l) => (n.dynCall_iiiiiijj = B.dynCall_iiiiiijj)(a, b, c, d, e, f, g, m, p, l);
3462
- n.___start_em_js = 467584;
3463
- n.___stop_em_js = 470208;
3462
+ n.___start_em_js = 467760;
3463
+ n.___stop_em_js = 470384;
3464
3464
  var Wd;
3465
3465
  Ga = function Xd() {
3466
3466
  Wd || Yd();
@@ -3520,7 +3520,7 @@ Yd();
3520
3520
  /* 2 */
3521
3521
  /***/ ((module) => {
3522
3522
 
3523
- module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.15.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}}');
3523
+ module.exports = JSON.parse('{"name":"@rive-app/webgl2","version":"2.16.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}}');
3524
3524
 
3525
3525
  /***/ }),
3526
3526
  /* 3 */
@@ -3814,6 +3814,7 @@ __webpack_require__.r(__webpack_exports__);
3814
3814
  /* harmony export */ LoopType: () => (/* binding */ LoopType),
3815
3815
  /* harmony export */ Rive: () => (/* binding */ Rive),
3816
3816
  /* harmony export */ RiveEventType: () => (/* binding */ RiveEventType),
3817
+ /* harmony export */ RiveFile: () => (/* binding */ RiveFile),
3817
3818
  /* harmony export */ RuntimeLoader: () => (/* binding */ RuntimeLoader),
3818
3819
  /* harmony export */ StateMachineInput: () => (/* binding */ StateMachineInput),
3819
3820
  /* harmony export */ StateMachineInputType: () => (/* binding */ StateMachineInputType),
@@ -4999,6 +5000,142 @@ var ObjectObservers = /** @class */ (function () {
4999
5000
  return ObjectObservers;
5000
5001
  }());
5001
5002
  var observers = new ObjectObservers();
5003
+ var RiveFile = /** @class */ (function () {
5004
+ function RiveFile(params) {
5005
+ // Allow the runtime to automatically load assets hosted in Rive's runtime.
5006
+ this.enableRiveAssetCDN = true;
5007
+ this.referenceCount = 0;
5008
+ this.src = params.src;
5009
+ this.buffer = params.buffer;
5010
+ if (params.assetLoader)
5011
+ this.assetLoader = params.assetLoader;
5012
+ this.enableRiveAssetCDN =
5013
+ typeof params.enableRiveAssetCDN == "boolean"
5014
+ ? params.enableRiveAssetCDN
5015
+ : true;
5016
+ // New event management system
5017
+ this.eventManager = new EventManager();
5018
+ if (params.onLoad)
5019
+ this.on(EventType.Load, params.onLoad);
5020
+ if (params.onLoadError)
5021
+ this.on(EventType.LoadError, params.onLoadError);
5022
+ }
5023
+ RiveFile.prototype.initData = function () {
5024
+ return __awaiter(this, void 0, void 0, function () {
5025
+ var _a, loader, _b;
5026
+ return __generator(this, function (_c) {
5027
+ switch (_c.label) {
5028
+ case 0:
5029
+ if (!this.src) return [3 /*break*/, 2];
5030
+ _a = this;
5031
+ return [4 /*yield*/, loadRiveFile(this.src)];
5032
+ case 1:
5033
+ _a.buffer = _c.sent();
5034
+ _c.label = 2;
5035
+ case 2:
5036
+ if (this.assetLoader) {
5037
+ loader = new this.runtime.CustomFileAssetLoader({
5038
+ loadContents: this.assetLoader,
5039
+ });
5040
+ }
5041
+ // Load the Rive file
5042
+ _b = this;
5043
+ return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];
5044
+ case 3:
5045
+ // Load the Rive file
5046
+ _b.file = _c.sent();
5047
+ if (this.file !== null) {
5048
+ this.eventManager.fire({
5049
+ type: EventType.Load,
5050
+ data: this,
5051
+ });
5052
+ }
5053
+ else {
5054
+ this.eventManager.fire({
5055
+ type: EventType.LoadError,
5056
+ data: null,
5057
+ });
5058
+ throw new Error(RiveFile.fileLoadErrorMessage);
5059
+ }
5060
+ return [2 /*return*/];
5061
+ }
5062
+ });
5063
+ });
5064
+ };
5065
+ RiveFile.prototype.init = function () {
5066
+ return __awaiter(this, void 0, void 0, function () {
5067
+ var _a;
5068
+ return __generator(this, function (_b) {
5069
+ switch (_b.label) {
5070
+ case 0:
5071
+ // If no source file url specified, it's a bust
5072
+ if (!this.src && !this.buffer) {
5073
+ throw new Error(RiveFile.missingErrorMessage);
5074
+ }
5075
+ _a = this;
5076
+ return [4 /*yield*/, RuntimeLoader.awaitInstance()];
5077
+ case 1:
5078
+ _a.runtime = _b.sent();
5079
+ return [4 /*yield*/, this.initData()];
5080
+ case 2:
5081
+ _b.sent();
5082
+ return [2 /*return*/];
5083
+ }
5084
+ });
5085
+ });
5086
+ };
5087
+ /**
5088
+ * Subscribe to Rive-generated events
5089
+ * @param type the type of event to subscribe to
5090
+ * @param callback callback to fire when the event occurs
5091
+ */
5092
+ RiveFile.prototype.on = function (type, callback) {
5093
+ this.eventManager.add({
5094
+ type: type,
5095
+ callback: callback,
5096
+ });
5097
+ };
5098
+ /**
5099
+ * Unsubscribes from a Rive-generated event
5100
+ * @param type the type of event to unsubscribe from
5101
+ * @param callback the callback to unsubscribe
5102
+ */
5103
+ RiveFile.prototype.off = function (type, callback) {
5104
+ this.eventManager.remove({
5105
+ type: type,
5106
+ callback: callback,
5107
+ });
5108
+ };
5109
+ RiveFile.prototype.cleanup = function () {
5110
+ var _a;
5111
+ this.referenceCount -= 1;
5112
+ if (this.referenceCount <= 0) {
5113
+ this.removeAllRiveEventListeners();
5114
+ (_a = this.file) === null || _a === void 0 ? void 0 : _a.delete();
5115
+ }
5116
+ };
5117
+ /**
5118
+ * Unsubscribes all Rive listeners from an event type, or everything if no type is
5119
+ * given
5120
+ * @param type the type of event to unsubscribe from, or all types if
5121
+ * undefined
5122
+ */
5123
+ RiveFile.prototype.removeAllRiveEventListeners = function (type) {
5124
+ this.eventManager.removeAll(type);
5125
+ };
5126
+ RiveFile.prototype.getInstance = function () {
5127
+ if (this.file !== null) {
5128
+ this.referenceCount += 1;
5129
+ return this.file;
5130
+ }
5131
+ };
5132
+ // Error message for missing source or buffer
5133
+ RiveFile.missingErrorMessage = "Rive source file or data buffer required";
5134
+ // Error message for file load error
5135
+ RiveFile.fileLoadErrorMessage = "The file failed to load";
5136
+ return RiveFile;
5137
+ }());
5138
+
5002
5139
  var Rive = /** @class */ (function () {
5003
5140
  function Rive(params) {
5004
5141
  var _this = this;
@@ -5047,6 +5184,7 @@ var Rive = /** @class */ (function () {
5047
5184
  }
5048
5185
  this.src = params.src;
5049
5186
  this.buffer = params.buffer;
5187
+ this.riveFile = params.riveFile;
5050
5188
  this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
5051
5189
  this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
5052
5190
  this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
@@ -5100,6 +5238,7 @@ var Rive = /** @class */ (function () {
5100
5238
  this.init({
5101
5239
  src: this.src,
5102
5240
  buffer: this.buffer,
5241
+ riveFile: this.riveFile,
5103
5242
  autoplay: params.autoplay,
5104
5243
  animations: params.animations,
5105
5244
  stateMachines: params.stateMachines,
@@ -5119,11 +5258,12 @@ var Rive = /** @class */ (function () {
5119
5258
  // Initializes the Rive object either from constructor or load()
5120
5259
  Rive.prototype.init = function (_a) {
5121
5260
  var _this = this;
5122
- var src = _a.src, buffer = _a.buffer, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c;
5261
+ var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c;
5123
5262
  this.src = src;
5124
5263
  this.buffer = buffer;
5264
+ this.riveFile = riveFile;
5125
5265
  // If no source file url specified, it's a bust
5126
- if (!this.src && !this.buffer) {
5266
+ if (!this.src && !this.buffer && !this.riveFile) {
5127
5267
  throw new Error(Rive.missingErrorMessage);
5128
5268
  }
5129
5269
  // List of animations that should be initialized.
@@ -5214,59 +5354,56 @@ var Rive = /** @class */ (function () {
5214
5354
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay) {
5215
5355
  var _a;
5216
5356
  return __awaiter(this, void 0, void 0, function () {
5217
- var _b, loader, _c, msg;
5218
- return __generator(this, function (_d) {
5219
- switch (_d.label) {
5357
+ var error_1, msg;
5358
+ return __generator(this, function (_b) {
5359
+ switch (_b.label) {
5220
5360
  case 0:
5221
- if (!this.src) return [3 /*break*/, 2];
5222
- _b = this;
5223
- return [4 /*yield*/, loadRiveFile(this.src)];
5361
+ _b.trys.push([0, 3, , 4]);
5362
+ if (!(this.riveFile == null)) return [3 /*break*/, 2];
5363
+ this.riveFile = new RiveFile({
5364
+ src: this.src,
5365
+ buffer: this.buffer,
5366
+ enableRiveAssetCDN: this.enableRiveAssetCDN,
5367
+ assetLoader: this.assetLoader,
5368
+ });
5369
+ return [4 /*yield*/, this.riveFile.init()];
5224
5370
  case 1:
5225
- _b.buffer = _d.sent();
5226
- _d.label = 2;
5371
+ _b.sent();
5372
+ _b.label = 2;
5227
5373
  case 2:
5228
- if (this.assetLoader) {
5229
- loader = new this.runtime.CustomFileAssetLoader({
5230
- loadContents: this.assetLoader,
5231
- });
5232
- }
5233
- // Load the Rive file
5234
- _c = this;
5235
- return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];
5374
+ this.file = this.riveFile.getInstance();
5375
+ // Initialize and draw frame
5376
+ this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay);
5377
+ // Check for audio
5378
+ this.initializeAudio();
5379
+ // Everything's set up, emit a load event
5380
+ this.loaded = true;
5381
+ this.eventManager.fire({
5382
+ type: EventType.Load,
5383
+ data: (_a = this.src) !== null && _a !== void 0 ? _a : "buffer",
5384
+ });
5385
+ // Flag ready for playback commands and clear the task queue; this order
5386
+ // is important or it may infinitely recurse
5387
+ this.readyForPlaying = true;
5388
+ this.taskQueue.process();
5389
+ this.drawFrame();
5390
+ return [2 /*return*/, Promise.resolve()];
5236
5391
  case 3:
5237
- // Load the Rive file
5238
- _c.file = _d.sent();
5239
- if (this.file) {
5240
- // Initialize and draw frame
5241
- this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay);
5242
- // Check for audio
5243
- this.initializeAudio();
5244
- // Everything's set up, emit a load event
5245
- this.loaded = true;
5246
- this.eventManager.fire({
5247
- type: EventType.Load,
5248
- data: (_a = this.src) !== null && _a !== void 0 ? _a : "buffer",
5249
- });
5250
- // Flag ready for playback commands and clear the task queue; this order
5251
- // is important or it may infinitely recurse
5252
- this.readyForPlaying = true;
5253
- this.taskQueue.process();
5254
- this.drawFrame();
5255
- return [2 /*return*/, Promise.resolve()];
5256
- }
5257
- else {
5258
- msg = "Problem loading file; may be corrupt!";
5259
- console.warn(msg);
5260
- this.eventManager.fire({ type: EventType.LoadError, data: msg });
5261
- return [2 /*return*/, Promise.reject(msg)];
5262
- }
5263
- return [2 /*return*/];
5392
+ error_1 = _b.sent();
5393
+ msg = "Problem loading file; may be corrupt!";
5394
+ console.warn(msg);
5395
+ this.eventManager.fire({ type: EventType.LoadError, data: msg });
5396
+ return [2 /*return*/, Promise.reject(msg)];
5397
+ case 4: return [2 /*return*/];
5264
5398
  }
5265
5399
  });
5266
5400
  });
5267
5401
  };
5268
5402
  // Initialize for playback
5269
5403
  Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay) {
5404
+ if (!this.file) {
5405
+ return;
5406
+ }
5270
5407
  // Fetch the artboard
5271
5408
  var rootArtboard = artboardName
5272
5409
  ? this.file.artboardByName(artboardName)
@@ -5486,8 +5623,8 @@ var Rive = /** @class */ (function () {
5486
5623
  if (this._observed !== null) {
5487
5624
  observers.remove(this._observed);
5488
5625
  }
5489
- // Delete the rive file
5490
- (_a = this.file) === null || _a === void 0 ? void 0 : _a.delete();
5626
+ (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
5627
+ this.riveFile = null;
5491
5628
  this.file = null;
5492
5629
  };
5493
5630
  /**
@@ -5651,6 +5788,7 @@ var Rive = /** @class */ (function () {
5651
5788
  };
5652
5789
  // Loads a new Rive file, keeping listeners in place
5653
5790
  Rive.prototype.load = function (params) {
5791
+ this.file = null;
5654
5792
  // Stop all animations
5655
5793
  this.stop();
5656
5794
  // Reinitialize
@@ -5729,7 +5867,7 @@ var Rive = /** @class */ (function () {
5729
5867
  // Returns a list of animation names on the chosen artboard
5730
5868
  get: function () {
5731
5869
  // If the file's not loaded, we got nothing to return
5732
- if (!this.loaded) {
5870
+ if (!this.loaded || !this.artboard) {
5733
5871
  return [];
5734
5872
  }
5735
5873
  var animationNames = [];
@@ -5747,7 +5885,7 @@ var Rive = /** @class */ (function () {
5747
5885
  */
5748
5886
  get: function () {
5749
5887
  // If the file's not loaded, we got nothing to return
5750
- if (!this.loaded) {
5888
+ if (!this.loaded || !this.artboard) {
5751
5889
  return [];
5752
5890
  }
5753
5891
  var stateMachineNames = [];