hytopia 0.1.72 → 0.1.73

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": "hytopia",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.api.json CHANGED
@@ -12714,91 +12714,6 @@
12714
12714
  ],
12715
12715
  "extendsTokenRanges": []
12716
12716
  },
12717
- {
12718
- "kind": "Interface",
12719
- "canonicalReference": "server!Event_2:interface",
12720
- "docComment": "/**\n * An EventRouter event.\n *\n * @public\n */\n",
12721
- "excerptTokens": [
12722
- {
12723
- "kind": "Content",
12724
- "text": "export interface Event<TPayload> "
12725
- }
12726
- ],
12727
- "fileUrlPath": "src/events/EventRouter.ts",
12728
- "releaseTag": "Public",
12729
- "typeParameters": [
12730
- {
12731
- "typeParameterName": "TPayload",
12732
- "constraintTokenRange": {
12733
- "startIndex": 0,
12734
- "endIndex": 0
12735
- },
12736
- "defaultTypeTokenRange": {
12737
- "startIndex": 0,
12738
- "endIndex": 0
12739
- }
12740
- }
12741
- ],
12742
- "name": "Event_2",
12743
- "preserveMemberOrder": false,
12744
- "members": [
12745
- {
12746
- "kind": "PropertySignature",
12747
- "canonicalReference": "server!Event_2#payload:member",
12748
- "docComment": "/**\n * The payload of the event, passed to listeners\n */\n",
12749
- "excerptTokens": [
12750
- {
12751
- "kind": "Content",
12752
- "text": "payload: "
12753
- },
12754
- {
12755
- "kind": "Content",
12756
- "text": "TPayload"
12757
- },
12758
- {
12759
- "kind": "Content",
12760
- "text": ";"
12761
- }
12762
- ],
12763
- "isReadonly": false,
12764
- "isOptional": false,
12765
- "releaseTag": "Public",
12766
- "name": "payload",
12767
- "propertyTypeTokenRange": {
12768
- "startIndex": 1,
12769
- "endIndex": 2
12770
- }
12771
- },
12772
- {
12773
- "kind": "PropertySignature",
12774
- "canonicalReference": "server!Event_2#type:member",
12775
- "docComment": "/**\n * The type of event\n */\n",
12776
- "excerptTokens": [
12777
- {
12778
- "kind": "Content",
12779
- "text": "type: "
12780
- },
12781
- {
12782
- "kind": "Content",
12783
- "text": "string"
12784
- },
12785
- {
12786
- "kind": "Content",
12787
- "text": ";"
12788
- }
12789
- ],
12790
- "isReadonly": false,
12791
- "isOptional": false,
12792
- "releaseTag": "Public",
12793
- "name": "type",
12794
- "propertyTypeTokenRange": {
12795
- "startIndex": 1,
12796
- "endIndex": 2
12797
- }
12798
- }
12799
- ],
12800
- "extendsTokenRanges": []
12801
- },
12802
12717
  {
12803
12718
  "kind": "Class",
12804
12719
  "canonicalReference": "server!EventRouter:class",
@@ -12850,20 +12765,23 @@
12850
12765
  {
12851
12766
  "kind": "Method",
12852
12767
  "canonicalReference": "server!EventRouter#emit:member(1)",
12853
- "docComment": "/**\n * Emit an event, invoking all registered listeners for the event type.\n *\n * @param event - The event to emit.\n *\n * @returns `true` if listeners were found and invoked, `false` otherwise.\n */\n",
12768
+ "docComment": "/**\n * Emit an event, invoking all registered listeners for the event type.\n *\n * @param eventType - The type of event to emit.\n *\n * @param payload - The payload to emit.\n *\n * @returns `true` if listeners were found and invoked, `false` otherwise.\n */\n",
12854
12769
  "excerptTokens": [
12855
12770
  {
12856
12771
  "kind": "Content",
12857
- "text": "emit<TPayload>(event: "
12772
+ "text": "emit<TPayload>(eventType: "
12858
12773
  },
12859
12774
  {
12860
- "kind": "Reference",
12861
- "text": "Event",
12862
- "canonicalReference": "server!Event_2:interface"
12775
+ "kind": "Content",
12776
+ "text": "string"
12863
12777
  },
12864
12778
  {
12865
12779
  "kind": "Content",
12866
- "text": "<TPayload>"
12780
+ "text": ", payload: "
12781
+ },
12782
+ {
12783
+ "kind": "Content",
12784
+ "text": "TPayload"
12867
12785
  },
12868
12786
  {
12869
12787
  "kind": "Content",
@@ -12893,18 +12811,26 @@
12893
12811
  ],
12894
12812
  "isStatic": false,
12895
12813
  "returnTypeTokenRange": {
12896
- "startIndex": 4,
12897
- "endIndex": 5
12814
+ "startIndex": 5,
12815
+ "endIndex": 6
12898
12816
  },
12899
12817
  "releaseTag": "Public",
12900
12818
  "isProtected": false,
12901
12819
  "overloadIndex": 1,
12902
12820
  "parameters": [
12903
12821
  {
12904
- "parameterName": "event",
12822
+ "parameterName": "eventType",
12905
12823
  "parameterTypeTokenRange": {
12906
12824
  "startIndex": 1,
12907
- "endIndex": 3
12825
+ "endIndex": 2
12826
+ },
12827
+ "isOptional": false
12828
+ },
12829
+ {
12830
+ "parameterName": "payload",
12831
+ "parameterTypeTokenRange": {
12832
+ "startIndex": 3,
12833
+ "endIndex": 4
12908
12834
  },
12909
12835
  "isOptional": false
12910
12836
  }
@@ -13191,7 +13117,7 @@
13191
13117
  {
13192
13118
  "kind": "Method",
13193
13119
  "canonicalReference": "server!EventRouter#on:member(1)",
13194
- "docComment": "/**\n * Register a listener for a specific event type.\n *\n * @remarks\n *\n * When the same event router instance used to register a listener emits an event a listener was registered for, the listener will be invoked with the event payload. Listeners are called in the order they are registered.\n *\n * @param eventType - The type of event to listen for.\n *\n * @param listener - The listener function to invoke when the event is emitted.\n */\n",
13120
+ "docComment": "/**\n * Register a listener for a specific event type.\n *\n * @remarks\n *\n * Listeners are invoked in the order they are registered.\n *\n * @param eventType - The type of event to listen for.\n *\n * @param listener - The listener function to invoke when the event is emitted.\n */\n",
13195
13121
  "excerptTokens": [
13196
13122
  {
13197
13123
  "kind": "Content",
@@ -13265,6 +13191,237 @@
13265
13191
  "isAbstract": false,
13266
13192
  "name": "on"
13267
13193
  },
13194
+ {
13195
+ "kind": "Method",
13196
+ "canonicalReference": "server!EventRouter#once:member(1)",
13197
+ "docComment": "/**\n * Register a listener for a specific event type that will be invoked once.\n *\n * @param eventType - The type of event to listen for.\n *\n * @param listener - The listener function to invoke when the event is emitted.\n */\n",
13198
+ "excerptTokens": [
13199
+ {
13200
+ "kind": "Content",
13201
+ "text": "once<TPayload>(eventType: "
13202
+ },
13203
+ {
13204
+ "kind": "Content",
13205
+ "text": "string"
13206
+ },
13207
+ {
13208
+ "kind": "Content",
13209
+ "text": ", listener: "
13210
+ },
13211
+ {
13212
+ "kind": "Content",
13213
+ "text": "(payload: TPayload) => void"
13214
+ },
13215
+ {
13216
+ "kind": "Content",
13217
+ "text": "): "
13218
+ },
13219
+ {
13220
+ "kind": "Content",
13221
+ "text": "void"
13222
+ },
13223
+ {
13224
+ "kind": "Content",
13225
+ "text": ";"
13226
+ }
13227
+ ],
13228
+ "typeParameters": [
13229
+ {
13230
+ "typeParameterName": "TPayload",
13231
+ "constraintTokenRange": {
13232
+ "startIndex": 0,
13233
+ "endIndex": 0
13234
+ },
13235
+ "defaultTypeTokenRange": {
13236
+ "startIndex": 0,
13237
+ "endIndex": 0
13238
+ }
13239
+ }
13240
+ ],
13241
+ "isStatic": false,
13242
+ "returnTypeTokenRange": {
13243
+ "startIndex": 5,
13244
+ "endIndex": 6
13245
+ },
13246
+ "releaseTag": "Public",
13247
+ "isProtected": false,
13248
+ "overloadIndex": 1,
13249
+ "parameters": [
13250
+ {
13251
+ "parameterName": "eventType",
13252
+ "parameterTypeTokenRange": {
13253
+ "startIndex": 1,
13254
+ "endIndex": 2
13255
+ },
13256
+ "isOptional": false
13257
+ },
13258
+ {
13259
+ "parameterName": "listener",
13260
+ "parameterTypeTokenRange": {
13261
+ "startIndex": 3,
13262
+ "endIndex": 4
13263
+ },
13264
+ "isOptional": false
13265
+ }
13266
+ ],
13267
+ "isOptional": false,
13268
+ "isAbstract": false,
13269
+ "name": "once"
13270
+ },
13271
+ {
13272
+ "kind": "Method",
13273
+ "canonicalReference": "server!EventRouter#prependOn:member(1)",
13274
+ "docComment": "/**\n * Register a listener for a specific event type that will be invoked before all other existing listeners.\n *\n * @param eventType - The type of event to listen for.\n *\n * @param listener - The listener function to invoke when the event is emitted.\n */\n",
13275
+ "excerptTokens": [
13276
+ {
13277
+ "kind": "Content",
13278
+ "text": "prependOn<TPayload>(eventType: "
13279
+ },
13280
+ {
13281
+ "kind": "Content",
13282
+ "text": "string"
13283
+ },
13284
+ {
13285
+ "kind": "Content",
13286
+ "text": ", listener: "
13287
+ },
13288
+ {
13289
+ "kind": "Content",
13290
+ "text": "(payload: TPayload) => void"
13291
+ },
13292
+ {
13293
+ "kind": "Content",
13294
+ "text": "): "
13295
+ },
13296
+ {
13297
+ "kind": "Content",
13298
+ "text": "void"
13299
+ },
13300
+ {
13301
+ "kind": "Content",
13302
+ "text": ";"
13303
+ }
13304
+ ],
13305
+ "typeParameters": [
13306
+ {
13307
+ "typeParameterName": "TPayload",
13308
+ "constraintTokenRange": {
13309
+ "startIndex": 0,
13310
+ "endIndex": 0
13311
+ },
13312
+ "defaultTypeTokenRange": {
13313
+ "startIndex": 0,
13314
+ "endIndex": 0
13315
+ }
13316
+ }
13317
+ ],
13318
+ "isStatic": false,
13319
+ "returnTypeTokenRange": {
13320
+ "startIndex": 5,
13321
+ "endIndex": 6
13322
+ },
13323
+ "releaseTag": "Public",
13324
+ "isProtected": false,
13325
+ "overloadIndex": 1,
13326
+ "parameters": [
13327
+ {
13328
+ "parameterName": "eventType",
13329
+ "parameterTypeTokenRange": {
13330
+ "startIndex": 1,
13331
+ "endIndex": 2
13332
+ },
13333
+ "isOptional": false
13334
+ },
13335
+ {
13336
+ "parameterName": "listener",
13337
+ "parameterTypeTokenRange": {
13338
+ "startIndex": 3,
13339
+ "endIndex": 4
13340
+ },
13341
+ "isOptional": false
13342
+ }
13343
+ ],
13344
+ "isOptional": false,
13345
+ "isAbstract": false,
13346
+ "name": "prependOn"
13347
+ },
13348
+ {
13349
+ "kind": "Method",
13350
+ "canonicalReference": "server!EventRouter#prependOnce:member(1)",
13351
+ "docComment": "/**\n * Register a listener for a specific event type that will be invoked once before all other existing listeners.\n *\n * @param eventType - The type of event to listen for.\n *\n * @param listener - The listener function to invoke when the event is emitted.\n */\n",
13352
+ "excerptTokens": [
13353
+ {
13354
+ "kind": "Content",
13355
+ "text": "prependOnce<TPayload>(eventType: "
13356
+ },
13357
+ {
13358
+ "kind": "Content",
13359
+ "text": "string"
13360
+ },
13361
+ {
13362
+ "kind": "Content",
13363
+ "text": ", listener: "
13364
+ },
13365
+ {
13366
+ "kind": "Content",
13367
+ "text": "(payload: TPayload) => void"
13368
+ },
13369
+ {
13370
+ "kind": "Content",
13371
+ "text": "): "
13372
+ },
13373
+ {
13374
+ "kind": "Content",
13375
+ "text": "void"
13376
+ },
13377
+ {
13378
+ "kind": "Content",
13379
+ "text": ";"
13380
+ }
13381
+ ],
13382
+ "typeParameters": [
13383
+ {
13384
+ "typeParameterName": "TPayload",
13385
+ "constraintTokenRange": {
13386
+ "startIndex": 0,
13387
+ "endIndex": 0
13388
+ },
13389
+ "defaultTypeTokenRange": {
13390
+ "startIndex": 0,
13391
+ "endIndex": 0
13392
+ }
13393
+ }
13394
+ ],
13395
+ "isStatic": false,
13396
+ "returnTypeTokenRange": {
13397
+ "startIndex": 5,
13398
+ "endIndex": 6
13399
+ },
13400
+ "releaseTag": "Public",
13401
+ "isProtected": false,
13402
+ "overloadIndex": 1,
13403
+ "parameters": [
13404
+ {
13405
+ "parameterName": "eventType",
13406
+ "parameterTypeTokenRange": {
13407
+ "startIndex": 1,
13408
+ "endIndex": 2
13409
+ },
13410
+ "isOptional": false
13411
+ },
13412
+ {
13413
+ "parameterName": "listener",
13414
+ "parameterTypeTokenRange": {
13415
+ "startIndex": 3,
13416
+ "endIndex": 4
13417
+ },
13418
+ "isOptional": false
13419
+ }
13420
+ ],
13421
+ "isOptional": false,
13422
+ "isAbstract": false,
13423
+ "name": "prependOnce"
13424
+ },
13268
13425
  {
13269
13426
  "kind": "Property",
13270
13427
  "canonicalReference": "server!EventRouter.serverInstance:member",
package/server.d.ts CHANGED
@@ -1621,15 +1621,6 @@ export declare interface EntityOptions {
1621
1621
  tintColor?: RgbColor;
1622
1622
  }
1623
1623
 
1624
- /** An EventRouter event. @public */
1625
- declare interface Event_2<TPayload> {
1626
- /** The type of event */
1627
- type: string;
1628
- /** The payload of the event, passed to listeners */
1629
- payload: TPayload;
1630
- }
1631
- export { Event_2 as Event }
1632
-
1633
1624
  /**
1634
1625
  * Manages event emission and assigned listener callbacks.
1635
1626
  *
@@ -1646,7 +1637,6 @@ export declare class EventRouter {
1646
1637
  /** The singleton instance for global server events. */
1647
1638
  static readonly serverInstance: EventRouter;
1648
1639
  private _emitter;
1649
- private _wrappedListenerMap;
1650
1640
  private _tag;
1651
1641
  /** Enable logging of all events. Default: false */
1652
1642
  logAllEvents: boolean;
@@ -1661,18 +1651,14 @@ export declare class EventRouter {
1661
1651
  /** @param tag - Tag for logging, used to identify EventRouter instances in logs. */
1662
1652
  constructor(tag: string);
1663
1653
  /**
1664
- * Register a listener for a specific event type.
1654
+ * Emit an event, invoking all registered listeners for the event type.
1665
1655
  *
1666
- * @remarks
1667
- * When the same event router instance used to register a listener
1668
- * emits an event a listener was registered for, the listener will
1669
- * be invoked with the event payload. Listeners are called in the order
1670
- * they are registered.
1656
+ * @param eventType - The type of event to emit.
1657
+ * @param payload - The payload to emit.
1671
1658
  *
1672
- * @param eventType - The type of event to listen for.
1673
- * @param listener - The listener function to invoke when the event is emitted.
1659
+ * @returns `true` if listeners were found and invoked, `false` otherwise.
1674
1660
  */
1675
- on<TPayload>(eventType: string, listener: (payload: TPayload) => void): void;
1661
+ emit<TPayload>(eventType: string, payload: TPayload): boolean;
1676
1662
  /**
1677
1663
  * Remove a listener for a specific event type.
1678
1664
  *
@@ -1687,12 +1673,36 @@ export declare class EventRouter {
1687
1673
  */
1688
1674
  offAll(eventType: string): void;
1689
1675
  /**
1690
- * Emit an event, invoking all registered listeners for the event type.
1676
+ * Register a listener for a specific event type.
1691
1677
  *
1692
- * @param event - The event to emit.
1693
- * @returns `true` if listeners were found and invoked, `false` otherwise.
1678
+ * @remarks
1679
+ * Listeners are invoked in the order they are registered.
1680
+ *
1681
+ * @param eventType - The type of event to listen for.
1682
+ * @param listener - The listener function to invoke when the event is emitted.
1683
+ */
1684
+ on<TPayload>(eventType: string, listener: (payload: TPayload) => void): void;
1685
+ /**
1686
+ * Register a listener for a specific event type that will be invoked once.
1687
+ *
1688
+ * @param eventType - The type of event to listen for.
1689
+ * @param listener - The listener function to invoke when the event is emitted.
1690
+ */
1691
+ once<TPayload>(eventType: string, listener: (payload: TPayload) => void): void;
1692
+ /**
1693
+ * Register a listener for a specific event type that will be invoked before all other existing listeners.
1694
+ *
1695
+ * @param eventType - The type of event to listen for.
1696
+ * @param listener - The listener function to invoke when the event is emitted.
1697
+ */
1698
+ prependOn<TPayload>(eventType: string, listener: (payload: TPayload) => void): void;
1699
+ /**
1700
+ * Register a listener for a specific event type that will be invoked once before all other existing listeners.
1701
+ *
1702
+ * @param eventType - The type of event to listen for.
1703
+ * @param listener - The listener function to invoke when the event is emitted.
1694
1704
  */
1695
- emit<TPayload>(event: Event_2<TPayload>): boolean;
1705
+ prependOnce<TPayload>(eventType: string, listener: (payload: TPayload) => void): void;
1696
1706
  }
1697
1707
 
1698
1708
  /**