hytopia 0.10.34 → 0.10.35-notifications-prerelease-2

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
+ A future timestamp in milliseconds 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.34",
3
+ "version": "0.10.35-notifications-prerelease-2",
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
@@ -35830,6 +35830,75 @@
35830
35830
  "isAbstract": false,
35831
35831
  "name": "resetInputs"
35832
35832
  },
35833
+ {
35834
+ "kind": "Method",
35835
+ "canonicalReference": "server!Player#scheduleNotification:member(1)",
35836
+ "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 - A future timestamp in milliseconds to schedule the notification for.\n *\n * @returns The id of the notification if it was scheduled successfully, undefined otherwise.\n */\n",
35837
+ "excerptTokens": [
35838
+ {
35839
+ "kind": "Content",
35840
+ "text": "scheduleNotification(type: "
35841
+ },
35842
+ {
35843
+ "kind": "Content",
35844
+ "text": "string"
35845
+ },
35846
+ {
35847
+ "kind": "Content",
35848
+ "text": ", scheduledFor: "
35849
+ },
35850
+ {
35851
+ "kind": "Content",
35852
+ "text": "number"
35853
+ },
35854
+ {
35855
+ "kind": "Content",
35856
+ "text": "): "
35857
+ },
35858
+ {
35859
+ "kind": "Reference",
35860
+ "text": "Promise",
35861
+ "canonicalReference": "!Promise:interface"
35862
+ },
35863
+ {
35864
+ "kind": "Content",
35865
+ "text": "<string | void>"
35866
+ },
35867
+ {
35868
+ "kind": "Content",
35869
+ "text": ";"
35870
+ }
35871
+ ],
35872
+ "isStatic": false,
35873
+ "returnTypeTokenRange": {
35874
+ "startIndex": 5,
35875
+ "endIndex": 7
35876
+ },
35877
+ "releaseTag": "Public",
35878
+ "isProtected": false,
35879
+ "overloadIndex": 1,
35880
+ "parameters": [
35881
+ {
35882
+ "parameterName": "type",
35883
+ "parameterTypeTokenRange": {
35884
+ "startIndex": 1,
35885
+ "endIndex": 2
35886
+ },
35887
+ "isOptional": false
35888
+ },
35889
+ {
35890
+ "parameterName": "scheduledFor",
35891
+ "parameterTypeTokenRange": {
35892
+ "startIndex": 3,
35893
+ "endIndex": 4
35894
+ },
35895
+ "isOptional": false
35896
+ }
35897
+ ],
35898
+ "isOptional": false,
35899
+ "isAbstract": false,
35900
+ "name": "scheduleNotification"
35901
+ },
35833
35902
  {
35834
35903
  "kind": "Method",
35835
35904
  "canonicalReference": "server!Player#setPersistedData:member(1)",
@@ -35914,6 +35983,59 @@
35914
35983
  "isProtected": false,
35915
35984
  "isAbstract": false
35916
35985
  },
35986
+ {
35987
+ "kind": "Method",
35988
+ "canonicalReference": "server!Player#unscheduleNotification:member(1)",
35989
+ "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",
35990
+ "excerptTokens": [
35991
+ {
35992
+ "kind": "Content",
35993
+ "text": "unscheduleNotification(notificationId: "
35994
+ },
35995
+ {
35996
+ "kind": "Content",
35997
+ "text": "string"
35998
+ },
35999
+ {
36000
+ "kind": "Content",
36001
+ "text": "): "
36002
+ },
36003
+ {
36004
+ "kind": "Reference",
36005
+ "text": "Promise",
36006
+ "canonicalReference": "!Promise:interface"
36007
+ },
36008
+ {
36009
+ "kind": "Content",
36010
+ "text": "<boolean>"
36011
+ },
36012
+ {
36013
+ "kind": "Content",
36014
+ "text": ";"
36015
+ }
36016
+ ],
36017
+ "isStatic": false,
36018
+ "returnTypeTokenRange": {
36019
+ "startIndex": 3,
36020
+ "endIndex": 5
36021
+ },
36022
+ "releaseTag": "Public",
36023
+ "isProtected": false,
36024
+ "overloadIndex": 1,
36025
+ "parameters": [
36026
+ {
36027
+ "parameterName": "notificationId",
36028
+ "parameterTypeTokenRange": {
36029
+ "startIndex": 1,
36030
+ "endIndex": 2
36031
+ },
36032
+ "isOptional": false
36033
+ }
36034
+ ],
36035
+ "isOptional": false,
36036
+ "isAbstract": false,
36037
+ "name": "unscheduleNotification"
36038
+ },
35917
36039
  {
35918
36040
  "kind": "Property",
35919
36041
  "canonicalReference": "server!Player#username:member",
@@ -38898,6 +39020,27 @@
38898
39020
  "releaseTag": "Public",
38899
39021
  "name": "RECONNECTED_WORLD"
38900
39022
  },
39023
+ {
39024
+ "kind": "EnumMember",
39025
+ "canonicalReference": "server!PlayerEvent.REQUEST_NOTIFICATION_PERMISSION:member",
39026
+ "docComment": "",
39027
+ "excerptTokens": [
39028
+ {
39029
+ "kind": "Content",
39030
+ "text": "REQUEST_NOTIFICATION_PERMISSION = "
39031
+ },
39032
+ {
39033
+ "kind": "Content",
39034
+ "text": "\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\""
39035
+ }
39036
+ ],
39037
+ "initializerTokenRange": {
39038
+ "startIndex": 1,
39039
+ "endIndex": 2
39040
+ },
39041
+ "releaseTag": "Public",
39042
+ "name": "REQUEST_NOTIFICATION_PERMISSION"
39043
+ },
38901
39044
  {
38902
39045
  "kind": "EnumMember",
38903
39046
  "canonicalReference": "server!PlayerEvent.REQUEST_SYNC:member",
@@ -39143,6 +39286,51 @@
39143
39286
  "endIndex": 8
39144
39287
  }
39145
39288
  },
39289
+ {
39290
+ "kind": "PropertySignature",
39291
+ "canonicalReference": "server!PlayerEventPayloads#\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\":member",
39292
+ "docComment": "/**\n * Emitted when notification permission is requested by a game.\n */\n",
39293
+ "excerptTokens": [
39294
+ {
39295
+ "kind": "Content",
39296
+ "text": "["
39297
+ },
39298
+ {
39299
+ "kind": "Reference",
39300
+ "text": "PlayerEvent.REQUEST_NOTIFICATION_PERMISSION",
39301
+ "canonicalReference": "server!PlayerEvent.REQUEST_NOTIFICATION_PERMISSION:member"
39302
+ },
39303
+ {
39304
+ "kind": "Content",
39305
+ "text": "]: "
39306
+ },
39307
+ {
39308
+ "kind": "Content",
39309
+ "text": "{\n player: "
39310
+ },
39311
+ {
39312
+ "kind": "Reference",
39313
+ "text": "Player",
39314
+ "canonicalReference": "server!Player:class"
39315
+ },
39316
+ {
39317
+ "kind": "Content",
39318
+ "text": ";\n }"
39319
+ },
39320
+ {
39321
+ "kind": "Content",
39322
+ "text": ";"
39323
+ }
39324
+ ],
39325
+ "isReadonly": false,
39326
+ "isOptional": false,
39327
+ "releaseTag": "Public",
39328
+ "name": "\"PLAYER.REQUEST_NOTIFICATION_PERMISSION\"",
39329
+ "propertyTypeTokenRange": {
39330
+ "startIndex": 3,
39331
+ "endIndex": 6
39332
+ }
39333
+ },
39146
39334
  {
39147
39335
  "kind": "PropertySignature",
39148
39336
  "canonicalReference": "server!PlayerEventPayloads#\"PLAYER.REQUEST_SYNC\":member",
package/server.d.ts CHANGED
@@ -4435,6 +4435,23 @@ export declare class Player extends EventRouter implements protocol.Serializable
4435
4435
  * @param world - The world to join the player to.
4436
4436
  */
4437
4437
  joinWorld(world: World): void;
4438
+ /**
4439
+ * Schedule a notification the player at a point in time in the future.
4440
+ * This will automatically handle prompting a player (if necessary) for
4441
+ * notification permissions in-game.
4442
+ *
4443
+ * @param type - The type of notification to schedule.
4444
+ * @param scheduledFor - A future timestamp in milliseconds to schedule the notification for.
4445
+ * @returns The id of the notification if it was scheduled successfully, undefined otherwise.
4446
+ */
4447
+ scheduleNotification(type: string, scheduledFor: number): Promise<string | void>;
4448
+ /**
4449
+ * Unschedules a scheduled notification for the player.
4450
+ *
4451
+ * @param notificationId - The id of the notification returned from {@link Player.scheduleNotification}.
4452
+ * @returns boolean - True if the notification was unscheduled, false otherwise.
4453
+ */
4454
+ unscheduleNotification(notificationId: string): Promise<boolean>;
4438
4455
 
4439
4456
 
4440
4457
  /**
@@ -4829,6 +4846,7 @@ export declare enum PlayerEvent {
4829
4846
  JOINED_WORLD = "PLAYER.JOINED_WORLD",
4830
4847
  LEFT_WORLD = "PLAYER.LEFT_WORLD",
4831
4848
  RECONNECTED_WORLD = "PLAYER.RECONNECTED_WORLD",
4849
+ REQUEST_NOTIFICATION_PERMISSION = "PLAYER.REQUEST_NOTIFICATION_PERMISSION",
4832
4850
  REQUEST_SYNC = "PLAYER.REQUEST_SYNC"
4833
4851
  }
4834
4852
 
@@ -4854,6 +4872,10 @@ export declare interface PlayerEventPayloads {
4854
4872
  player: Player;
4855
4873
  world: World;
4856
4874
  };
4875
+ /** Emitted when notification permission is requested by a game. */
4876
+ [PlayerEvent.REQUEST_NOTIFICATION_PERMISSION]: {
4877
+ player: Player;
4878
+ };
4857
4879
  /** Emitted when a player's client requests a round trip time synchronization. */
4858
4880
  [PlayerEvent.REQUEST_SYNC]: {
4859
4881
  player: Player;