@m2c2kit/core 0.3.7 → 0.3.9

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +217 -52
  2. package/dist/index.js +529 -218
  3. package/package.json +7 -7
package/dist/index.d.ts CHANGED
@@ -14,16 +14,6 @@ declare global {
14
14
  }
15
15
  //# sourceMappingURL=Globals.d.ts.map
16
16
 
17
- /**
18
- * The type of activity.
19
- *
20
- * @remarks Currently, m2c2kit has only Game and Survey activities.
21
- */
22
- declare enum ActivityType {
23
- Game = "Game",
24
- Survey = "Survey"
25
- }
26
-
27
17
  /** Base interface for all Activity events. */
28
18
  interface ActivityEvent extends EventBase {
29
19
  target: Activity;
@@ -34,6 +24,16 @@ interface ActivityKeyValueData {
34
24
  [key: string]: string | number | boolean | object | undefined | null;
35
25
  }
36
26
 
27
+ /**
28
+ * The type of activity.
29
+ *
30
+ * @remarks Currently, m2c2kit has only Game and Survey activities.
31
+ */
32
+ declare enum ActivityType {
33
+ Game = "Game",
34
+ Survey = "Survey"
35
+ }
36
+
37
37
  /** A snapshot of performance at a single point in time.
38
38
  *
39
39
  * @remarks This describes performance of the application internals, not the
@@ -96,6 +96,14 @@ interface ActivityResults {
96
96
  activityMetrics?: Array<ActivityMetric>;
97
97
  }
98
98
 
99
+ /**
100
+ * Notifies when an activity starts, ends, cancels, or
101
+ * creates data.
102
+ */
103
+ interface ActivityLifecycleEvent extends ActivityEvent {
104
+ results?: ActivityResults;
105
+ }
106
+
99
107
  /**
100
108
  * Dispatched when new data is created by an activity.
101
109
  *
@@ -129,7 +137,7 @@ interface ActivityResultsEvent extends ActivityEvent, ActivityResults {
129
137
  * ...
130
138
  * const db: IDataStore = new LocalDatabase();
131
139
  * session.dataStore = db;
132
- * session.init();
140
+ * session.initialize();
133
141
  * ```
134
142
  */
135
143
  interface IDataStore {
@@ -705,6 +713,13 @@ declare class I18n {
705
713
  private mergeAdditionalTranslations;
706
714
  }
707
715
 
716
+ interface CallbackOptions {
717
+ /** Should the provided callback replace any existing callbacks of the same event type for this target? Default is false */
718
+ replaceExisting?: boolean;
719
+ /** String identifier used to identify the callback. Only needed if the callback will be removed later */
720
+ key?: string;
721
+ }
722
+
708
723
  interface TrialData {
709
724
  [key: string]: string | number | boolean | object | undefined | null;
710
725
  }
@@ -718,6 +733,7 @@ declare class Game implements Activity {
718
733
  options: GameOptions;
719
734
  beginTimestamp: number;
720
735
  beginIso8601Timestamp: string;
736
+ private eventListeners;
721
737
  private gameMetrics;
722
738
  private fpsMetricReportThreshold;
723
739
  private maximumRecordedActivityMetrics;
@@ -739,6 +755,7 @@ declare class Game implements Activity {
739
755
  constructor(options: GameOptions);
740
756
  private addLocalizationParametersToGameParameters;
741
757
  init(): Promise<void>;
758
+ initialize(): Promise<void>;
742
759
  /**
743
760
  * Saves an item to the activity's key-value store.
744
761
  *
@@ -747,7 +764,7 @@ declare class Game implements Activity {
747
764
  * ```
748
765
  * const db: IDataStore = new LocalDatabase();
749
766
  * session.dataStore = db;
750
- * session.init();
767
+ * session.initialize();
751
768
  * ```
752
769
  * @param key - item key
753
770
  * @param value - item value
@@ -765,7 +782,7 @@ declare class Game implements Activity {
765
782
  * ```
766
783
  * const db: IDataStore = new LocalDatabase();
767
784
  * session.dataStore = db;
768
- * session.init();
785
+ * session.initialize();
769
786
  * ```
770
787
  * @param key - item key
771
788
  * @param globalStore - if true, treat the item as "global" and not
@@ -782,7 +799,7 @@ declare class Game implements Activity {
782
799
  * ```
783
800
  * const db: IDataStore = new LocalDatabase();
784
801
  * session.dataStore = db;
785
- * session.init();
802
+ * session.initialize();
786
803
  * ```
787
804
  * @param key - item key
788
805
  * @param globalStore - if true, treat the item as "global" and not
@@ -798,7 +815,7 @@ declare class Game implements Activity {
798
815
  * ```
799
816
  * const db: IDataStore = new LocalDatabase();
800
817
  * session.dataStore = db;
801
- * session.init();
818
+ * session.initialize();
802
819
  * ```
803
820
  */
804
821
  storeClearItems(): Promise<void>;
@@ -810,7 +827,7 @@ declare class Game implements Activity {
810
827
  * ```
811
828
  * const db: IDataStore = new LocalDatabase();
812
829
  * session.dataStore = db;
813
- * session.init();
830
+ * session.initialize();
814
831
  * ```
815
832
  * @param globalStore - if true, treat the item as "global" and not
816
833
  * associated with a specific activity; global items can be accessed
@@ -825,7 +842,7 @@ declare class Game implements Activity {
825
842
  * ```
826
843
  * const db: IDataStore = new LocalDatabase();
827
844
  * session.dataStore = db;
828
- * session.init();
845
+ * session.initialize();
829
846
  * ```
830
847
  * @param key - item key
831
848
  * @param globalStore - if true, treat the item as "global" and not
@@ -1098,21 +1115,23 @@ declare class Game implements Activity {
1098
1115
  /**
1099
1116
  * Should be called when current game has ended successfully.
1100
1117
  *
1101
- * @remarks This will trigger the onActivityLifecycleChange callback function,
1102
- * if one was provided in SessionOptions. This is how the game can communicate
1103
- * its state to the parent session. It is the responsibility of the the game
1104
- * programmer to call this at the appropriate time. It is not triggered
1105
- * automatically.
1118
+ * @remarks This will send an ActivityEnd event to any listeners, such as
1119
+ * a function provided to Game.onEnd() or a callback defined in
1120
+ * SessionOptions.activityCallbacks.onActivityLifecycle. This is how the
1121
+ * game can communicate changes in activity state to the parent session.
1122
+ * It is the responsibility of the the game programmer to call this at the
1123
+ * appropriate time. It is not triggered automatically.
1106
1124
  */
1107
1125
  end(): void;
1108
1126
  /**
1109
1127
  * Should be called when current game has been canceled by a user action.
1110
1128
  *
1111
- * @remarks This will trigger the onActivityLifecycleChange callback function,
1112
- * if one was provided in SessionOptions. This is how the game can communicate
1113
- * its state to the parent session. It is the responsibility of the the game
1114
- * programmer to call this at the appropriate time. It is not triggered
1115
- * automatically.
1129
+ * @remarks This will send an ActivityCancel event to any listeners, such as
1130
+ * a function provided to Game.onCancel() or a callback defined in
1131
+ * SessionOptions.activityCallbacks.onActivityLifecycle. This is how the
1132
+ * game can communicate changes in activity state to the parent session.
1133
+ * It is the responsibility of the the game programmer to call this at the
1134
+ * appropriate time. It is not triggered automatically.
1116
1135
  */
1117
1136
  cancel(): void;
1118
1137
  private setupHtmlCanvases;
@@ -1161,10 +1180,10 @@ declare class Game implements Activity {
1161
1180
  *
1162
1181
  * @param type - the type of event to listen for, e.g., "tapDown"
1163
1182
  * @param entityName - the entity name for which an event will be listened
1164
- * @param callback
1165
- * @param replaceExistingCallback
1183
+ * @param callback - the callback to be invoked when the event occurs
1184
+ * @param callbackOptions
1166
1185
  */
1167
- createEventListener(type: EventType, entityName: string, callback: (event: EntityEvent) => void, replaceExistingCallback?: boolean): void;
1186
+ createEventListener(type: EventType, entityName: string, callback: (event: EntityEvent) => void, callbackOptions?: CallbackOptions): void;
1168
1187
  /**
1169
1188
  * Returns array of all entities that have been added to the game object.
1170
1189
  */
@@ -1211,6 +1230,36 @@ declare class Game implements Activity {
1211
1230
  private raiseM2DragEvent;
1212
1231
  private raiseM2DragEndEvent;
1213
1232
  private calculatePointWithinEntityFromDomPointerEvent;
1233
+ /**
1234
+ * Executes a callback when the game starts.
1235
+ *
1236
+ * @param callback - function to execute.
1237
+ * @param options - options for the callback.
1238
+ */
1239
+ onStart(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
1240
+ /**
1241
+ * Executes a callback when the game is canceled.
1242
+ *
1243
+ * @param callback - function to execute.
1244
+ * @param options - options for the callback.
1245
+ */
1246
+ onCancel(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
1247
+ /**
1248
+ * Executes a callback when the game ends.
1249
+ *
1250
+ * @param callback - function to execute.
1251
+ * @param options - options for the callback.
1252
+ */
1253
+ onEnd(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
1254
+ /**
1255
+ * Executes a callback when the game generates data.
1256
+ *
1257
+ * @param callback - function to execute.
1258
+ * @param options - options for the callback.
1259
+ */
1260
+ onData(callback: (activityResultsEvent: ActivityResultsEvent) => void, options?: CallbackOptions): void;
1261
+ private addEventListener;
1262
+ private raiseActivityEventOnListeners;
1214
1263
  private raiseEventOnListeningEntities;
1215
1264
  private sceneCanReceiveUserInteraction;
1216
1265
  /**
@@ -1288,14 +1337,6 @@ declare class FontManager {
1288
1337
  loadAllGamesFontData(): void;
1289
1338
  }
1290
1339
 
1291
- /**
1292
- * Notifies when an activity starts, ends, cancels, or
1293
- * creates data.
1294
- */
1295
- interface ActivityLifecycleEvent extends ActivityEvent {
1296
- results?: ActivityResults;
1297
- }
1298
-
1299
1340
  interface ActivityCallbacks {
1300
1341
  /** Callback executed when the activity lifecycle changes, such as when it ends. */
1301
1342
  onActivityLifecycle?: (event: ActivityLifecycleEvent) => void;
@@ -1332,6 +1373,12 @@ interface SessionOptions {
1332
1373
  sessionUuid?: string;
1333
1374
  /** URL of session assets folder (which contains wasm binary), if not the default location of "assets" */
1334
1375
  assetsUrl?: string;
1376
+ /** After the session initializes, should the session automatically start? Default is true */
1377
+ autoStartAfterInit?: boolean;
1378
+ /** When an activity ends or is canceled, should the session automatically go to the next activity? Default is true */
1379
+ autoGoToNextActivity?: boolean;
1380
+ /** After the last activity ends or is canceled, should the session automatically end? Default is true */
1381
+ autoEndAfterLastActivity?: boolean;
1335
1382
  /** NOT IMPLEMENTED YET: Orientation the screen should be locked to for this session. Value will be passed into the ScreenOrientation.lock() Web API. */
1336
1383
  orientation?: "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
1337
1384
  }
@@ -1343,8 +1390,10 @@ declare class Session {
1343
1390
  currentActivity?: Activity;
1344
1391
  uuid: string;
1345
1392
  dataStore?: IDataStore;
1393
+ private eventListeners;
1346
1394
  private sessionDictionary;
1347
1395
  private canvasKit?;
1396
+ private initialized;
1348
1397
  private version;
1349
1398
  /**
1350
1399
  * A Session contains one or more activities. The session manages the start
@@ -1353,10 +1402,71 @@ declare class Session {
1353
1402
  * @param options
1354
1403
  */
1355
1404
  constructor(options: SessionOptions);
1405
+ /**
1406
+ * Executes a callback when the session initializes.
1407
+ *
1408
+ * @param callback - function to execute.
1409
+ * @param options - options for the callback.
1410
+ */
1411
+ onInitialize(callback: (sessionLifecycleEvent: SessionLifecycleEvent) => void, options?: CallbackOptions): void;
1412
+ /**
1413
+ * Executes a callback when the session starts.
1414
+ *
1415
+ * @param callback - function to execute.
1416
+ * @param options - options for the callback.
1417
+ */
1418
+ onStart(callback: (sessionLifecycleEvent: SessionLifecycleEvent) => void, options?: CallbackOptions): void;
1419
+ /**
1420
+ * Executes a callback when the session ends.
1421
+ *
1422
+ * @param callback - function to execute.
1423
+ * @param options - options for the callback.
1424
+ */
1425
+ onEnd(callback: (sessionLifecycleEvent: SessionLifecycleEvent) => void, options?: CallbackOptions): void;
1426
+ /**
1427
+ * Executes a callback when any activity in the session generates data.
1428
+ *
1429
+ * @param callback - function to execute.
1430
+ * @param options - options for the callback.
1431
+ */
1432
+ onActivityData(callback: (activityResultsEvent: ActivityResultsEvent) => void, options?: CallbackOptions): void;
1433
+ private addEventListener;
1434
+ private raiseEventOnListeners;
1435
+ private sessionActivityStartHandler;
1436
+ private sessionActivityCancelHandler;
1437
+ private sessionActivityEndHandler;
1438
+ private sessionActivityLifecycleHandler;
1439
+ private activityResultsEventHandler;
1356
1440
  /**
1357
1441
  * Asynchronously initializes the m2c2kit engine and loads assets
1442
+ *
1443
+ * @deprecated Use Session.initialize() instead.
1358
1444
  */
1359
1445
  init(): Promise<void>;
1446
+ /**
1447
+ * Check if the Activity uses the deprecated init() method.
1448
+ *
1449
+ * @remarks Activity.init() is deprecated and should be replaced with
1450
+ * Activity.initialize().
1451
+ *
1452
+ * @param activity
1453
+ * @returns true if the activity defines its own init() method, false otherwise.
1454
+ */
1455
+ private activityUsesDeprecatedInit;
1456
+ /**
1457
+ * Asynchronously initializes the m2c2kit engine and loads assets
1458
+ */
1459
+ initialize(): Promise<void>;
1460
+ /**
1461
+ * Waits for the session to be initialized.
1462
+ *
1463
+ * @remarks Session.initialize() is asynchronous, and it should be awaited
1464
+ * so that the session is fully initialized before calling Session.start().
1465
+ * If it is not awaited (or it cannot be awaited because the target
1466
+ * environment does not support top-level await), this function ensures that
1467
+ * the session has been initialized.
1468
+ */
1469
+ private waitForSessionInitialization;
1360
1470
  /**
1361
1471
  * Starts the session and starts the first activity.
1362
1472
  */
@@ -1465,12 +1575,60 @@ type SessionDictionaryValues = string | number | boolean | object | null | undef
1465
1575
  interface Activity {
1466
1576
  /** The type of activity: Game or Survey */
1467
1577
  type: ActivityType;
1468
- /** Initializes the activity. All code to create the activity's appearance and behavior must be placed in this method. This method is asynchronous, and must be awaited. When writing a new game by extending the `Game` class, this method will be overridden, but the base method must still be called with `await super.init()`. */
1578
+ /**
1579
+ * Initializes the activity.
1580
+ *
1581
+ * @remarks All code to create the activity's appearance and behavior must
1582
+ * be placed in this method. This method is asynchronous, and must be
1583
+ * awaited. When writing a new game by extending the `Game` class, this
1584
+ * method will be overridden, but the base method must still be called with
1585
+ * `await super.initialize()`.
1586
+ */
1587
+ initialize(): Promise<void>;
1588
+ /**
1589
+ * Initializes the activity.
1590
+ *
1591
+ * @remarks All code to create the activity's appearance and behavior must
1592
+ * be placed in this method. This method is asynchronous, and must be
1593
+ * awaited. When writing a new game by extending the `Game` class, this
1594
+ * method will be overridden, but the base method must still be called with
1595
+ * `await super.init()`.
1596
+ *
1597
+ * @deprecated use Game.initialize() instead.
1598
+ */
1469
1599
  init(): Promise<void>;
1470
1600
  /** Starts the activity */
1471
1601
  start(): Promise<void>;
1472
1602
  /** Stops the activity */
1473
1603
  stop(): void;
1604
+ /**
1605
+ * Executes a callback when the activity starts.
1606
+ *
1607
+ * @param callback - function to execute.
1608
+ * @param options - options for the callback.
1609
+ */
1610
+ onStart(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
1611
+ /**
1612
+ * Executes a callback when the activity is canceled.
1613
+ *
1614
+ * @param callback - function to execute.
1615
+ * @param options - options for the callback.
1616
+ */
1617
+ onCancel(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
1618
+ /**
1619
+ * Executes a callback when the activity ends.
1620
+ *
1621
+ * @param callback - function to execute.
1622
+ * @param options - options for the callback.
1623
+ */
1624
+ onEnd(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
1625
+ /**
1626
+ * Executes a callback when the activity generates data.
1627
+ *
1628
+ * @param callback - function to execute.
1629
+ * @param options - options for the callback.
1630
+ */
1631
+ onData(callback: (activityResultsEvent: ActivityResultsEvent) => void, options?: CallbackOptions): void;
1474
1632
  /** The activity's parent session */
1475
1633
  session: Session;
1476
1634
  /** The activity's unique identifier. NOTE: This is newly generated each session. The uuid for an activity will vary across sessions. */
@@ -1731,7 +1889,7 @@ declare abstract class Entity implements EntityOptions {
1731
1889
  * ones. It is strongly recommended not to change this, unless you have a
1732
1890
  * special use case. Default is true.
1733
1891
  */
1734
- onTapDown(callback: (tapEvent: TapEvent) => void, replaceExistingCallback?: boolean): void;
1892
+ onTapDown(callback: (tapEvent: TapEvent) => void, callbackOptions?: CallbackOptions): void;
1735
1893
  /**
1736
1894
  * Executes a callback when the user releases a press, that has been fully
1737
1895
  * within the entity, from the entity.
@@ -1747,7 +1905,7 @@ declare abstract class Entity implements EntityOptions {
1747
1905
  * ones. It is strongly recommended not to change this, unless you have a
1748
1906
  * special use case. Default is true.
1749
1907
  */
1750
- onTapUp(callback: (tapEvent: TapEvent) => void, replaceExistingCallback?: boolean): void;
1908
+ onTapUp(callback: (tapEvent: TapEvent) => void, callbackOptions?: CallbackOptions): void;
1751
1909
  /**
1752
1910
  * Executes a callback when the user releases a press from the entity within
1753
1911
  * the bounds of the entity.
@@ -1764,7 +1922,7 @@ declare abstract class Entity implements EntityOptions {
1764
1922
  * ones. It is strongly recommended not to change this, unless you have a
1765
1923
  * special use case. Default is true.
1766
1924
  */
1767
- onTapUpAny(callback: (tapEvent: TapEvent) => void, replaceExistingCallback?: boolean): void;
1925
+ onTapUpAny(callback: (tapEvent: TapEvent) => void, callbackOptions?: CallbackOptions): void;
1768
1926
  /**
1769
1927
  * Executes a callback when the user moves the pointer (mouse, touches) beyond
1770
1928
  * the bounds of the entity while the pointer is down.
@@ -1780,7 +1938,7 @@ declare abstract class Entity implements EntityOptions {
1780
1938
  * ones. It is strongly recommended not to change this, unless you have a
1781
1939
  * special use case. Default is true.
1782
1940
  */
1783
- onTapLeave(callback: (tapEvent: TapEvent) => void, replaceExistingCallback?: boolean): void;
1941
+ onTapLeave(callback: (tapEvent: TapEvent) => void, callbackOptions?: CallbackOptions): void;
1784
1942
  /**
1785
1943
  * Executes a callback when the pointer first is down on the entity.
1786
1944
  *
@@ -1794,7 +1952,7 @@ declare abstract class Entity implements EntityOptions {
1794
1952
  * ones. It is strongly recommended not to change this, unless you have a
1795
1953
  * special use case. Default is true.
1796
1954
  */
1797
- onPointerDown(callback: (m2PointerEvent: M2PointerEvent) => void, replaceExistingCallback?: boolean): void;
1955
+ onPointerDown(callback: (m2PointerEvent: M2PointerEvent) => void, callbackOptions?: CallbackOptions): void;
1798
1956
  /**
1799
1957
  * Executes a callback when the user releases a press from the entity within
1800
1958
  * the bounds of the entity.
@@ -1810,7 +1968,7 @@ declare abstract class Entity implements EntityOptions {
1810
1968
  * ones. It is strongly recommended not to change this, unless you have a
1811
1969
  * special use case. Default is true.
1812
1970
  */
1813
- onPointerUp(callback: (m2PointerEvent: M2PointerEvent) => void, replaceExistingCallback?: boolean): void;
1971
+ onPointerUp(callback: (m2PointerEvent: M2PointerEvent) => void, callbackOptions?: CallbackOptions): void;
1814
1972
  /**
1815
1973
  * Executes a callback when the user moves the pointer (mouse or touches)
1816
1974
  * within the bounds of the entity.
@@ -1822,7 +1980,7 @@ declare abstract class Entity implements EntityOptions {
1822
1980
  * ones. It is strongly recommended not to change this, unless you have a
1823
1981
  * special use case. Default is true.
1824
1982
  */
1825
- onPointerMove(callback: (m2PointerEvent: M2PointerEvent) => void, replaceExistingCallback?: boolean): void;
1983
+ onPointerMove(callback: (m2PointerEvent: M2PointerEvent) => void, callbackOptions?: CallbackOptions): void;
1826
1984
  /**
1827
1985
  * Executes a callback when the user begins dragging an entity.
1828
1986
  *
@@ -1833,7 +1991,7 @@ declare abstract class Entity implements EntityOptions {
1833
1991
  * ones. It is strongly recommended not to change this, unless you have a
1834
1992
  * special use case. Default is true.
1835
1993
  */
1836
- onDragStart(callback: (m2DragEvent: M2DragEvent) => void, replaceExistingCallback?: boolean): void;
1994
+ onDragStart(callback: (m2DragEvent: M2DragEvent) => void, callbackOptions?: CallbackOptions): void;
1837
1995
  /**
1838
1996
  * Executes a callback when the user continues dragging an entity.
1839
1997
  *
@@ -1844,7 +2002,7 @@ declare abstract class Entity implements EntityOptions {
1844
2002
  * ones. It is strongly recommended not to change this, unless you have a
1845
2003
  * special use case. Default is true.
1846
2004
  */
1847
- onDrag(callback: (m2DragEvent: M2DragEvent) => void, replaceExistingCallback?: boolean): void;
2005
+ onDrag(callback: (m2DragEvent: M2DragEvent) => void, callbackOptions?: CallbackOptions): void;
1848
2006
  /**
1849
2007
  * Executes a callback when the user stop dragging an entity.
1850
2008
  *
@@ -1855,8 +2013,8 @@ declare abstract class Entity implements EntityOptions {
1855
2013
  * ones. It is strongly recommended not to change this, unless you have a
1856
2014
  * special use case. Default is true.
1857
2015
  */
1858
- onDragEnd(callback: (m2DragEvent: M2DragEvent) => void, replaceExistingCallback?: boolean): void;
1859
- private addEventListener;
2016
+ onDragEnd(callback: (m2DragEvent: M2DragEvent) => void, callbackOptions?: CallbackOptions): void;
2017
+ addEventListener(type: EventType, callback: (ev: EntityEvent) => void, callbackOptions?: CallbackOptions): void;
1860
2018
  private parseLayoutConstraints;
1861
2019
  private calculateYFromConstraint;
1862
2020
  private calculateXFromConstraint;
@@ -2184,6 +2342,7 @@ declare class Constants {
2184
2342
  static readonly OUTGOING_SCENE_NAME = "__outgoingScene";
2185
2343
  static readonly OUTGOING_SCENE_SPRITE_NAME = "__outgoingSceneSprite";
2186
2344
  static readonly OUTGOING_SCENE_IMAGE_NAME = "__outgoingSceneSnapshot";
2345
+ static readonly SESSION_INITIALIZATION_POLLING_INTERVAL_MS = 50;
2187
2346
  }
2188
2347
 
2189
2348
  /**
@@ -2226,6 +2385,12 @@ declare class Equals {
2226
2385
  static rgbaColor(color1?: RgbaColor, color2?: RgbaColor): boolean;
2227
2386
  }
2228
2387
 
2388
+ interface EventListenerBase {
2389
+ type: EventType;
2390
+ callback: (event: EventBase) => void;
2391
+ key?: string;
2392
+ }
2393
+
2229
2394
  interface IText {
2230
2395
  text?: string;
2231
2396
  fontName?: string;
@@ -2581,7 +2746,7 @@ declare class Sprite extends Entity implements IDrawable, SpriteOptions {
2581
2746
  /**
2582
2747
  * Visual image displayed on the screen.
2583
2748
  *
2584
- * @remarks Images that will be used to create the sprite must be loaded during the Game.init() method prior to their use.
2749
+ * @remarks Images that will be used to create the sprite must be loaded during the Game.initialize() method prior to their use.
2585
2750
  *
2586
2751
  * @param options - {@link SpriteOptions}
2587
2752
  */
@@ -2935,4 +3100,4 @@ declare class WebGlInfo {
2935
3100
  static dispose(): void;
2936
3101
  }
2937
3102
 
2938
- export { Action, Activity, ActivityKeyValueData, ActivityLifecycleEvent, ActivityResultsEvent, ActivityType, BrowserImage, CanvasKitHelpers, Composite, CompositeOptions, Constants, ConstraintType, Constraints, CustomAction, CustomActionOptions, DefaultParameter, Dimensions, DrawableOptions, EasingFunction, Easings, Entity, EntityEvent, EntityEventListener, EntityOptions, EntityType, Equals, EventBase, EventType, FontData, FontManager, Game, GameData, GameOptions, GameParameters, GlobalVariables, GoToActivityOptions, GroupAction, I18n, IDataStore, IDrawable, IText, ImageManager, Label, LabelHorizontalAlignmentMode, LabelOptions, Layout, LayoutConstraint, LoadedImage, M2DragEvent, M2Path, MoveAction, MoveActionOptions, MutablePath, NoneTransition, Point, RandomDraws, RectOptions, RgbaColor, ScaleAction, ScaleActionOptions, Scene, SceneOptions, SceneTransition, SequenceAction, Session, SessionDictionaryValues, SessionLifecycleEvent, SessionOptions, Shape, ShapeOptions, ShapeType, Size, SlideTransition, SlideTransitionOptions, Sprite, SpriteOptions, Story, StoryOptions, TextLine, TextLineOptions, TextOptions, Timer, Transition, TransitionDirection, TransitionType, Translations, TrialData, TrialSchema, Uuid, WaitAction, WaitActionOptions, WebColors, WebGlInfo, handleInterfaceOptions };
3103
+ export { Action, Activity, ActivityKeyValueData, ActivityLifecycleEvent, ActivityResultsEvent, ActivityType, BrowserImage, CallbackOptions, CanvasKitHelpers, Composite, CompositeOptions, Constants, ConstraintType, Constraints, CustomAction, CustomActionOptions, DefaultParameter, Dimensions, DrawableOptions, EasingFunction, Easings, Entity, EntityEvent, EntityEventListener, EntityOptions, EntityType, Equals, EventBase, EventListenerBase, EventType, FontData, FontManager, Game, GameData, GameOptions, GameParameters, GlobalVariables, GoToActivityOptions, GroupAction, I18n, IDataStore, IDrawable, IText, ImageManager, Label, LabelHorizontalAlignmentMode, LabelOptions, Layout, LayoutConstraint, LoadedImage, M2DragEvent, M2Path, MoveAction, MoveActionOptions, MutablePath, NoneTransition, Point, RandomDraws, RectOptions, RgbaColor, ScaleAction, ScaleActionOptions, Scene, SceneOptions, SceneTransition, SequenceAction, Session, SessionDictionaryValues, SessionLifecycleEvent, SessionOptions, Shape, ShapeOptions, ShapeType, Size, SlideTransition, SlideTransitionOptions, Sprite, SpriteOptions, Story, StoryOptions, TextLine, TextLineOptions, TextOptions, Timer, Transition, TransitionDirection, TransitionType, Translations, TrialData, TrialSchema, Uuid, WaitAction, WaitActionOptions, WebColors, WebGlInfo, handleInterfaceOptions };