You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/types.ts
+58-72Lines changed: 58 additions & 72 deletions
Original file line number
Diff line number
Diff line change
@@ -2,218 +2,204 @@ import { Types } from 'ably';
2
2
importtype{LockAttributes}from'./Locks.js';
3
3
4
4
/**
5
-
* Options to configure the behaviour of a {@link Cursors | `Cursors`} instance.
5
+
* Options to configure the behavior of a {@link Cursors | `Cursors`} instance.
6
6
*/
7
7
exportinterfaceCursorsOptions{
8
8
/**
9
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
10
-
* The interval in milliseconds at which a batch of cursor positions are published. This is multiplied by the number of members in the space minus 1. The default value is 25ms.
11
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
9
+
* The interval, in milliseconds, at which a batch of cursor positions are published. This is multiplied by the number of members in a space, minus 1. The default value is 25ms. Decreasing the value will improve performance by further ‘smoothing’ the movement of cursors at the cost of increasing the number of events sent.
12
10
*/
13
11
outboundBatchInterval: number;
14
12
/**
15
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
16
13
* The number of pages searched from [history](https://ably.com/docs/storage-history/history) for the last published cursor position. The default is 5.
17
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
18
14
*/
19
15
paginationLimit: number;
20
16
}
21
17
22
18
/**
23
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
24
19
* Represents a cursors position.
25
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
26
20
*/
27
21
exportinterfaceCursorPosition{
28
22
/**
29
-
* <!-- MOVED FROM Cursors.set -->
30
23
* The position of the member’s cursor on the X-axis.
31
24
*/
32
25
x: number;
33
26
/**
34
-
* <!-- MOVED FROM Cursors.set -->
35
27
* The position of the member’s cursor on the Y-axis.
36
28
*/
37
29
y: number;
38
30
}
39
31
40
32
/**
41
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
42
-
* Represent data that can be associated with a cursor update.
43
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
33
+
* Represents data that can be associated with a cursor update. A JSON-serializable object containing additional information about the cursor, such as a color or the ID of an element the cursor is dragging.
44
34
*/
45
35
exporttypeCursorData=Record<string,unknown>;
46
36
47
37
/**
48
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
49
-
* Represents an update to a cursor.
50
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
38
+
* Represents a cursor update event.
39
+
*
40
+
* The following is an example payload of a cursor event. Cursor events are uniquely identifiable by the {@link CursorUpdate.connectionId | `connectionId`} of a cursor.
41
+
*
42
+
* ```json
43
+
* {
44
+
* "hd9743gjDc": {
45
+
* "connectionId": "hd9743gjDc",
46
+
* "clientId": "clemons#142",
47
+
* "position": {
48
+
* "x": 864,
49
+
* "y": 32
50
+
* },
51
+
* "data": {
52
+
* "color": "red"
53
+
* }
54
+
* }
55
+
* }
56
+
* ```
51
57
*/
52
58
exportinterfaceCursorUpdate{
53
59
/**
54
-
* <!-- MOVED FROM Cursors.set -->
55
60
* The [client identifier](https://ably.com/docs/auth/identified-clients) for the member.
56
61
*/
57
62
clientId: string;
58
63
/**
59
-
* <!-- MOVED FROM Cursors.set -->
60
64
* The unique identifier of the member’s [connection](https://ably.com/docs/connect).
61
65
*/
62
66
connectionId: string;
63
67
/**
64
-
* <!-- MOVED FROM Cursors.set -->
65
68
* An object containing the position of a member’s cursor.
66
69
*/
67
70
position: CursorPosition;
68
71
/**
69
-
* <!-- MOVED FROM Cursors.set -->
70
72
* An optional arbitrary JSON-serializable object containing additional information about the cursor.
71
73
*/
72
74
data?: CursorData;
73
75
}
74
76
75
77
/**
76
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
77
-
* Used to configure a Space instance on creation.
78
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
78
+
* Options to configure a {@link Space | Space} instance on its creation.
79
79
*/
80
80
exportinterfaceSpaceOptions{
81
81
/**
82
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
83
82
* Number of milliseconds after a user loses connection or closes their browser window to wait before their {@link SpaceMember} object is removed from the members list. The default is 120000ms (2 minutes).
84
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
85
83
*/
86
84
offlineTimeout: number;
87
85
/**
88
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
89
-
* Options relating to configuring the cursors API (see below).
90
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
86
+
* Options to configure live cursors behavior.
91
87
*/
92
88
cursors: CursorsOptions;
93
89
}
94
90
95
91
/**
96
-
* <!-- MOVED WITH EDITING FROM Space.enter -->
97
-
* Profile data can be set when {@link Space.enter | entering } a space. It is optional data that can be used to associate information with a member, such as a preferred username, or profile picture that can be subsequently displayed in their avatar. Profile data can be any arbitrary JSON-serializable object.
92
+
* Optional data that is associated with a member. Examples include a preferred username, or a profile picture that can be subsequently displayed in their avatar. Can be any arbitrary JSON-serializable object.
* A SpaceMember represents a member within a Space instance. Each new connection that enters will create a new member, even if they have the same [`clientId`](https://ably.com/docs/auth/identified-clients?lang=javascript).
104
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
97
+
* Represents a member within a Space instance. Each new connection that enters will create a new member, even if they have the same [`clientId`](https://ably.com/docs/auth/identified-clients).
98
+
*
99
+
* The following is an example payload of a `SpaceMember`:
* The client identifier for the user, provided to the ably client instance.
110
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
120
+
* The [client identifier](https://ably.com/docs/auth/identified-clients) for the member.
111
121
*/
112
122
clientId: string;
113
123
/**
114
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
115
-
* Identifier for the connection used by the user. This is a unique identifier.
116
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
124
+
* The unique identifier of the member’s [connection](https://ably.com/docs/connect).
117
125
*/
118
126
connectionId: string;
119
127
/**
120
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
121
-
* Whether the user is connected to Ably.
122
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
128
+
* Whether the user is connected to Ably or not.
123
129
*/
124
130
isConnected: boolean;
125
131
/**
126
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
127
-
* Optional user data that can be attached to a user, such as a username or image to display in an avatar stack.
128
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
132
+
* Optional data that is associated with a member, such as a preferred username or profile picture to display in an avatar stack.
129
133
*/
130
134
profileData: ProfileData;
131
135
/**
132
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
133
136
* The current location of the user within the space.
134
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
135
137
*/
136
138
location: unknown;
137
139
/**
138
-
* <!-- BEGIN CLASS-DEFINITIONS DOCUMENTATION -->
139
-
* The most recent event emitted by [presence](https://ably.com/docs/presence-occupancy/presence?lang=javascript) and its timestamp. Events will be either `enter`, `leave`, `update` or `present`.
140
-
* <!-- END CLASS-DEFINITIONS DOCUMENTATION -->
140
+
* The most recent event emitted by [presence](https://ably.com/docs/presence-occupancy/presence) and its timestamp. Events will be either `enter`, `leave`, `update` or `present`.
141
141
*/
142
142
lastEvent: {
143
143
/**
144
-
* <!-- MOVED FROM Locations.subscribe -->
145
144
* The most recent event emitted by the member.
146
145
*/
147
146
name: Types.PresenceAction;
148
147
/**
149
-
* <!-- MOVED FROM Locations.subscribe -->
150
148
* The timestamp of the most recently emitted event.
151
149
*/
152
150
timestamp: number;
153
151
};
154
152
}
155
153
156
154
/**
157
-
* The `LockStatuses` namespace describes the possible values of the {@link LockStatus} type.
155
+
* Describes the possible values of the {@link LockStatus} type.
158
156
*/
159
157
exportnamespaceLockStatuses{
160
158
/**
161
-
* <!-- MOVED WITH EDITING FROM Locks -->
162
-
* A member has requested a lock by calling { @link Locks.acquire | `acquire()` }.
159
+
* A member has requested a lock by calling {@link Locks.acquire | `acquire()`}.
163
160
*/
164
161
exporttypePending='pending';
165
162
/**
166
-
* <!-- MOVED FROM Locks -->
167
-
* The lock is confirmed to be held by the requesting member.
163
+
* A lock is confirmed to be held by the requesting member.
168
164
*/
169
165
exporttypeLocked='locked';
170
166
/**
171
-
* <!-- MOVED WITH EDITING FROM Locks -->
172
-
* The lock is confirmed to not be locked by the requesting member, or has been { @link Locks.release | released } by a member previously holding the lock.
167
+
* A lock is confirmed to not be locked by the requesting member, or has been {@link Locks.release | released} by a member previously holding the lock.
0 commit comments