hytopia 0.10.18 → 0.10.20

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.
@@ -291,6 +291,20 @@ Joins a player to a world.
291
291
  Resets all inputs keys
292
292
 
293
293
 
294
+ </td></tr>
295
+ <tr><td>
296
+
297
+ [scheduleNotification(type, scheduledFor)](./server.player.schedulenotification.md)
298
+
299
+
300
+ </td><td>
301
+
302
+
303
+ </td><td>
304
+
305
+ Schedule a notification the player at a point in time in the future. This will automatically handle prompting a player (if necessary) for notification permissions in-game.
306
+
307
+
294
308
  </td></tr>
295
309
  <tr><td>
296
310
 
@@ -305,6 +319,20 @@ Resets all inputs keys
305
319
  Set the persisted data for the player. This data can later be retrieved using [Player.getPersistedData()](./server.player.getpersisteddata.md)<!-- -->, even if a player disconnects and rejoin a game in the future, or joins a different HYTOPIA managed lobby of your game.
306
320
 
307
321
 
322
+ </td></tr>
323
+ <tr><td>
324
+
325
+ [unscheduleNotification(notificationId)](./server.player.unschedulenotification.md)
326
+
327
+
328
+ </td><td>
329
+
330
+
331
+ </td><td>
332
+
333
+ Unschedules a scheduled notification for the player.
334
+
335
+
308
336
  </td></tr>
309
337
  </tbody></table>
310
338
 
@@ -0,0 +1,72 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Player](./server.player.md) &gt; [scheduleNotification](./server.player.schedulenotification.md)
4
+
5
+ ## Player.scheduleNotification() method
6
+
7
+ Schedule a notification the player at a point in time in the future. This will automatically handle prompting a player (if necessary) for notification permissions in-game.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ scheduleNotification(type: string, scheduledFor: number): Promise<string | void>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ type
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The type of notification to schedule.
46
+
47
+
48
+ </td></tr>
49
+ <tr><td>
50
+
51
+ scheduledFor
52
+
53
+
54
+ </td><td>
55
+
56
+ number
57
+
58
+
59
+ </td><td>
60
+
61
+ The point in time in the future to schedule the notification for.
62
+
63
+
64
+ </td></tr>
65
+ </tbody></table>
66
+
67
+ **Returns:**
68
+
69
+ Promise&lt;string \| void&gt;
70
+
71
+ The id of the notification if it was scheduled successfully, undefined otherwise.
72
+
@@ -0,0 +1,56 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Player](./server.player.md) &gt; [unscheduleNotification](./server.player.unschedulenotification.md)
4
+
5
+ ## Player.unscheduleNotification() method
6
+
7
+ Unschedules a scheduled notification for the player.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ unscheduleNotification(notificationId: string): Promise<boolean>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ notificationId
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The id of the notification returned from [Player.scheduleNotification()](./server.player.schedulenotification.md)<!-- -->.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ Promise&lt;boolean&gt;
54
+
55
+ boolean - True if the notification was unscheduled, false otherwise.
56
+
@@ -85,6 +85,20 @@ RECONNECTED\_WORLD
85
85
  </td><td>
86
86
 
87
87
 
88
+ </td></tr>
89
+ <tr><td>
90
+
91
+ REQUEST\_NOTIFICATION\_PERMISSION
92
+
93
+
94
+ </td><td>
95
+
96
+ `"PLAYER.REQUEST_NOTIFICATION_PERMISSION"`
97
+
98
+
99
+ </td><td>
100
+
101
+
88
102
  </td></tr>
89
103
  <tr><td>
90
104
 
@@ -0,0 +1,15 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [PlayerEventPayloads](./server.playereventpayloads.md) &gt; ["PLAYER.REQUEST\_NOTIFICATION\_PERMISSION"](./server.playereventpayloads._player.request_notification_permission_.md)
4
+
5
+ ## PlayerEventPayloads."PLAYER.REQUEST\_NOTIFICATION\_PERMISSION" property
6
+
7
+ Emitted when notification permission is requested by a game.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ [PlayerEvent.REQUEST_NOTIFICATION_PERMISSION]: {
13
+ player: Player;
14
+ };
15
+ ```
@@ -110,6 +110,25 @@ Emitted when a player leaves a world.
110
110
  Emitted when a player reconnects to a world after a unintentional disconnect.
111
111
 
112
112
 
113
+ </td></tr>
114
+ <tr><td>
115
+
116
+ ["PLAYER.REQUEST\_NOTIFICATION\_PERMISSION"](./server.playereventpayloads._player.request_notification_permission_.md)
117
+
118
+
119
+ </td><td>
120
+
121
+
122
+ </td><td>
123
+
124
+ { player: [Player](./server.player.md)<!-- -->; }
125
+
126
+
127
+ </td><td>
128
+
129
+ Emitted when notification permission is requested by a game.
130
+
131
+
113
132
  </td></tr>
114
133
  <tr><td>
115
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.10.18",
3
+ "version": "0.10.20",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",
package/server.api.json CHANGED
@@ -35782,6 +35782,75 @@
35782
35782
  "isAbstract": false,
35783
35783
  "name": "resetInputs"
35784
35784
  },
35785
+ {
35786
+ "kind": "Method",
35787
+ "canonicalReference": "server!Player#scheduleNotification:member(1)",
35788
+ "docComment": "/**\n * Schedule a notification the player at a point in time in the future. This will automatically handle prompting a player (if necessary) for notification permissions in-game.\n *\n * @param type - The type of notification to schedule.\n *\n * @param scheduledFor - The point in time in the future to schedule the notification for.\n *\n * @returns The id of the notification if it was scheduled successfully, undefined otherwise.\n */\n",
35789
+ "excerptTokens": [
35790
+ {
35791
+ "kind": "Content",
35792
+ "text": "scheduleNotification(type: "
35793
+ },
35794
+ {
35795
+ "kind": "Content",
35796
+ "text": "string"
35797
+ },
35798
+ {
35799
+ "kind": "Content",
35800
+ "text": ", scheduledFor: "
35801
+ },
35802
+ {
35803
+ "kind": "Content",
35804
+ "text": "number"
35805
+ },
35806
+ {
35807
+ "kind": "Content",
35808
+ "text": "): "
35809
+ },
35810
+ {
35811
+ "kind": "Reference",
35812
+ "text": "Promise",
35813
+ "canonicalReference": "!Promise:interface"
35814
+ },
35815
+ {
35816
+ "kind": "Content",
35817
+ "text": "<string | void>"
35818
+ },
35819
+ {
35820
+ "kind": "Content",
35821
+ "text": ";"
35822
+ }
35823
+ ],
35824
+ "isStatic": false,
35825
+ "returnTypeTokenRange": {
35826
+ "startIndex": 5,
35827
+ "endIndex": 7
35828
+ },
35829
+ "releaseTag": "Public",
35830
+ "isProtected": false,
35831
+ "overloadIndex": 1,
35832
+ "parameters": [
35833
+ {
35834
+ "parameterName": "type",
35835
+ "parameterTypeTokenRange": {
35836
+ "startIndex": 1,
35837
+ "endIndex": 2
35838
+ },
35839
+ "isOptional": false
35840
+ },
35841
+ {
35842
+ "parameterName": "scheduledFor",
35843
+ "parameterTypeTokenRange": {
35844
+ "startIndex": 3,
35845
+ "endIndex": 4
35846
+ },
35847
+ "isOptional": false
35848
+ }
35849
+ ],
35850
+ "isOptional": false,
35851
+ "isAbstract": false,
35852
+ "name": "scheduleNotification"
35853
+ },
35785
35854
  {
35786
35855
  "kind": "Method",
35787
35856
  "canonicalReference": "server!Player#setPersistedData:member(1)",
@@ -35871,6 +35940,59 @@
35871
35940
  "isProtected": false,
35872
35941
  "isAbstract": false
35873
35942
  },
35943
+ {
35944
+ "kind": "Method",
35945
+ "canonicalReference": "server!Player#unscheduleNotification:member(1)",
35946
+ "docComment": "/**\n * Unschedules a scheduled notification for the player.\n *\n * @param notificationId - The id of the notification returned from {@link Player.scheduleNotification}.\n *\n * @returns boolean - True if the notification was unscheduled, false otherwise.\n */\n",
35947
+ "excerptTokens": [
35948
+ {
35949
+ "kind": "Content",
35950
+ "text": "unscheduleNotification(notificationId: "
35951
+ },
35952
+ {
35953
+ "kind": "Content",
35954
+ "text": "string"
35955
+ },
35956
+ {
35957
+ "kind": "Content",
35958
+ "text": "): "
35959
+ },
35960
+ {
35961
+ "kind": "Reference",
35962
+ "text": "Promise",
35963
+ "canonicalReference": "!Promise:interface"
35964
+ },
35965
+ {
35966
+ "kind": "Content",
35967
+ "text": "<boolean>"
35968
+ },
35969
+ {
35970
+ "kind": "Content",
35971
+ "text": ";"
35972
+ }
35973
+ ],
35974
+ "isStatic": false,
35975
+ "returnTypeTokenRange": {
35976
+ "startIndex": 3,
35977
+ "endIndex": 5
35978
+ },
35979
+ "releaseTag": "Public",
35980
+ "isProtected": false,
35981
+ "overloadIndex": 1,
35982
+ "parameters": [
35983
+ {
35984
+ "parameterName": "notificationId",
35985
+ "parameterTypeTokenRange": {
35986
+ "startIndex": 1,
35987
+ "endIndex": 2
35988
+ },
35989
+ "isOptional": false
35990
+ }
35991
+ ],
35992
+ "isOptional": false,
35993
+ "isAbstract": false,
35994
+ "name": "unscheduleNotification"
35995
+ },
35874
35996
  {
35875
35997
  "kind": "Property",
35876
35998
  "canonicalReference": "server!Player#username:member",
@@ -38855,6 +38977,27 @@
38855
38977
  "releaseTag": "Public",
38856
38978
  "name": "RECONNECTED_WORLD"
38857
38979
  },
38980
+ {
38981
+ "kind": "EnumMember",
38982
+ "canonicalReference": "server!PlayerEvent.REQUEST_NOTIFICATION_PERMISSION:member",
38983
+ "docComment": "",
38984
+ "excerptTokens": [
38985
+ {
38986
+ "kind": "Content",
38987
+ "text": "REQUEST_NOTIFICATION_PERMISSION = "
38988
+ },
38989
+ {
38990
+ "kind": "Content",
38991
+ "text": "\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\""
38992
+ }
38993
+ ],
38994
+ "initializerTokenRange": {
38995
+ "startIndex": 1,
38996
+ "endIndex": 2
38997
+ },
38998
+ "releaseTag": "Public",
38999
+ "name": "REQUEST_NOTIFICATION_PERMISSION"
39000
+ },
38858
39001
  {
38859
39002
  "kind": "EnumMember",
38860
39003
  "canonicalReference": "server!PlayerEvent.REQUEST_SYNC:member",
@@ -39100,6 +39243,51 @@
39100
39243
  "endIndex": 8
39101
39244
  }
39102
39245
  },
39246
+ {
39247
+ "kind": "PropertySignature",
39248
+ "canonicalReference": "server!PlayerEventPayloads#\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\":member",
39249
+ "docComment": "/**\n * Emitted when notification permission is requested by a game.\n */\n",
39250
+ "excerptTokens": [
39251
+ {
39252
+ "kind": "Content",
39253
+ "text": "["
39254
+ },
39255
+ {
39256
+ "kind": "Reference",
39257
+ "text": "PlayerEvent.REQUEST_NOTIFICATION_PERMISSION",
39258
+ "canonicalReference": "server!PlayerEvent.REQUEST_NOTIFICATION_PERMISSION:member"
39259
+ },
39260
+ {
39261
+ "kind": "Content",
39262
+ "text": "]: "
39263
+ },
39264
+ {
39265
+ "kind": "Content",
39266
+ "text": "{\n player: "
39267
+ },
39268
+ {
39269
+ "kind": "Reference",
39270
+ "text": "Player",
39271
+ "canonicalReference": "server!Player:class"
39272
+ },
39273
+ {
39274
+ "kind": "Content",
39275
+ "text": ";\n }"
39276
+ },
39277
+ {
39278
+ "kind": "Content",
39279
+ "text": ";"
39280
+ }
39281
+ ],
39282
+ "isReadonly": false,
39283
+ "isOptional": false,
39284
+ "releaseTag": "Public",
39285
+ "name": "\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\"",
39286
+ "propertyTypeTokenRange": {
39287
+ "startIndex": 3,
39288
+ "endIndex": 6
39289
+ }
39290
+ },
39103
39291
  {
39104
39292
  "kind": "PropertySignature",
39105
39293
  "canonicalReference": "server!PlayerEventPayloads#\"PLAYER.REQUEST_SYNC\":member",
package/server.d.ts CHANGED
@@ -4424,6 +4424,23 @@ export declare class Player extends EventRouter implements protocol.Serializable
4424
4424
  * @param world - The world to join the player to.
4425
4425
  */
4426
4426
  joinWorld(world: World): void;
4427
+ /**
4428
+ * Schedule a notification the player at a point in time in the future.
4429
+ * This will automatically handle prompting a player (if necessary) for
4430
+ * notification permissions in-game.
4431
+ *
4432
+ * @param type - The type of notification to schedule.
4433
+ * @param scheduledFor - The point in time in the future to schedule the notification for.
4434
+ * @returns The id of the notification if it was scheduled successfully, undefined otherwise.
4435
+ */
4436
+ scheduleNotification(type: string, scheduledFor: number): Promise<string | void>;
4437
+ /**
4438
+ * Unschedules a scheduled notification for the player.
4439
+ *
4440
+ * @param notificationId - The id of the notification returned from {@link Player.scheduleNotification}.
4441
+ * @returns boolean - True if the notification was unscheduled, false otherwise.
4442
+ */
4443
+ unscheduleNotification(notificationId: string): Promise<boolean>;
4427
4444
 
4428
4445
 
4429
4446
  /**
@@ -4818,6 +4835,7 @@ export declare enum PlayerEvent {
4818
4835
  JOINED_WORLD = "PLAYER.JOINED_WORLD",
4819
4836
  LEFT_WORLD = "PLAYER.LEFT_WORLD",
4820
4837
  RECONNECTED_WORLD = "PLAYER.RECONNECTED_WORLD",
4838
+ REQUEST_NOTIFICATION_PERMISSION = "PLAYER.REQUEST_NOTIFICATION_PERMISSION",
4821
4839
  REQUEST_SYNC = "PLAYER.REQUEST_SYNC"
4822
4840
  }
4823
4841
 
@@ -4843,6 +4861,10 @@ export declare interface PlayerEventPayloads {
4843
4861
  player: Player;
4844
4862
  world: World;
4845
4863
  };
4864
+ /** Emitted when notification permission is requested by a game. */
4865
+ [PlayerEvent.REQUEST_NOTIFICATION_PERMISSION]: {
4866
+ player: Player;
4867
+ };
4846
4868
  /** Emitted when a player's client requests a round trip time synchronization. */
4847
4869
  [PlayerEvent.REQUEST_SYNC]: {
4848
4870
  player: Player;