@fluidframework/map 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0
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/.eslintrc.js +11 -16
- package/.mocharc.js +2 -2
- package/README.md +3 -3
- package/api-extractor.json +2 -2
- package/dist/directory.d.ts +1 -1
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +40 -18
- package/dist/directory.js.map +1 -1
- package/dist/interfaces.d.ts +12 -12
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/internalInterfaces.d.ts.map +1 -1
- package/dist/internalInterfaces.js.map +1 -1
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.js.map +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +4 -2
- package/dist/map.js.map +1 -1
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +33 -22
- package/dist/mapKernel.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/directory.d.ts +1 -1
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +42 -20
- package/lib/directory.js.map +1 -1
- package/lib/interfaces.d.ts +12 -12
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/internalInterfaces.d.ts.map +1 -1
- package/lib/internalInterfaces.js.map +1 -1
- package/lib/localValues.d.ts.map +1 -1
- package/lib/localValues.js.map +1 -1
- package/lib/map.d.ts +1 -1
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +5 -3
- package/lib/map.js.map +1 -1
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +34 -23
- package/lib/mapKernel.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +50 -50
- package/prettier.config.cjs +1 -1
- package/src/directory.ts +1952 -1875
- package/src/interfaces.ts +303 -306
- package/src/internalInterfaces.ts +67 -67
- package/src/localValues.ts +85 -94
- package/src/map.ts +363 -355
- package/src/mapKernel.ts +725 -690
- package/src/packageVersion.ts +1 -1
- package/tsconfig.esnext.json +5 -5
- package/tsconfig.json +9 -15
package/src/interfaces.ts
CHANGED
|
@@ -4,23 +4,28 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
IDisposable,
|
|
9
|
+
IEvent,
|
|
10
|
+
IEventProvider,
|
|
11
|
+
IEventThisPlaceHolder,
|
|
12
|
+
} from "@fluidframework/common-definitions";
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Type of "valueChanged" event parameter.
|
|
11
16
|
*/
|
|
12
17
|
export interface IValueChanged {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The key storing the value that changed.
|
|
20
|
+
*/
|
|
21
|
+
key: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The value that was stored at the key prior to the change.
|
|
25
|
+
*/
|
|
26
|
+
// TODO: Use `unknown` instead (breaking change).
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
previousValue: any;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
/**
|
|
@@ -30,76 +35,79 @@ export interface IValueChanged {
|
|
|
30
35
|
*/
|
|
31
36
|
// TODO: Use `unknown` instead (breaking change).
|
|
32
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
export interface IDirectory
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
38
|
+
export interface IDirectory
|
|
39
|
+
extends Map<string, any>,
|
|
40
|
+
IEventProvider<IDirectoryEvents>,
|
|
41
|
+
Partial<IDisposable> {
|
|
42
|
+
/**
|
|
43
|
+
* The absolute path of the directory.
|
|
44
|
+
*/
|
|
45
|
+
readonly absolutePath: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the value stored at the given key from the directory.
|
|
49
|
+
* @param key - Key to retrieve from
|
|
50
|
+
* @returns The stored value, or undefined if the key is not set
|
|
51
|
+
*/
|
|
52
|
+
// TODO: Use `unknown` instead (breaking change).
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
get<T = any>(key: string): T | undefined;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Sets the value stored at key to the provided value.
|
|
58
|
+
* @param key - Key to set at
|
|
59
|
+
* @param value - Value to set
|
|
60
|
+
* @returns The IDirectory itself
|
|
61
|
+
*/
|
|
62
|
+
set<T = unknown>(key: string, value: T): this;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get the number of sub directory within the directory.
|
|
66
|
+
* @returns The number of sub directory within a directory.
|
|
67
|
+
*/
|
|
68
|
+
countSubDirectory?(): number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the
|
|
72
|
+
* same name already exists.
|
|
73
|
+
* @param subdirName - Name of the new child directory to create
|
|
74
|
+
* @returns The IDirectory child that was created or retrieved
|
|
75
|
+
*/
|
|
76
|
+
createSubDirectory(subdirName: string): IDirectory;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Gets an IDirectory child of this IDirectory, if it exists.
|
|
80
|
+
* @param subdirName - Name of the child directory to get
|
|
81
|
+
* @returns The requested IDirectory
|
|
82
|
+
*/
|
|
83
|
+
getSubDirectory(subdirName: string): IDirectory | undefined;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Checks whether this directory has a child directory with the given name.
|
|
87
|
+
* @param subdirName - Name of the child directory to check
|
|
88
|
+
* @returns True if it exists, false otherwise
|
|
89
|
+
*/
|
|
90
|
+
hasSubDirectory(subdirName: string): boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.
|
|
94
|
+
* @param subdirName - Name of the child directory to delete
|
|
95
|
+
* @returns True if the IDirectory existed and was deleted, false if it did not exist
|
|
96
|
+
*/
|
|
97
|
+
deleteSubDirectory(subdirName: string): boolean;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Gets an iterator over the IDirectory children of this IDirectory.
|
|
101
|
+
* @returns The IDirectory iterator
|
|
102
|
+
*/
|
|
103
|
+
subdirectories(): IterableIterator<[string, IDirectory]>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get an IDirectory within the directory, in order to use relative paths from that location.
|
|
107
|
+
* @param relativePath - Path of the IDirectory to get, relative to this IDirectory
|
|
108
|
+
* @returns The requested IDirectory
|
|
109
|
+
*/
|
|
110
|
+
getWorkingDirectory(relativePath: string): IDirectory | undefined;
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
/**
|
|
@@ -107,159 +115,150 @@ export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryE
|
|
|
107
115
|
* These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.
|
|
108
116
|
*/
|
|
109
117
|
export interface ISharedDirectoryEvents extends ISharedObjectEvents {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
target: IEventThisPlaceHolder,
|
|
177
|
-
) => void);
|
|
118
|
+
/**
|
|
119
|
+
* Emitted when a key is set or deleted. This is emitted for any key in the {@link ISharedDirectory} or any
|
|
120
|
+
* subdirectory.
|
|
121
|
+
*
|
|
122
|
+
* @remarks Listener parameters:
|
|
123
|
+
*
|
|
124
|
+
* - `changed` - Information on the key that changed, its value prior to the change, and the path to the
|
|
125
|
+
* key that changed.
|
|
126
|
+
*
|
|
127
|
+
* - `local` - Whether the change originated from this client.
|
|
128
|
+
*
|
|
129
|
+
* - `target` - The {@link ISharedDirectory} itself.
|
|
130
|
+
*/
|
|
131
|
+
(
|
|
132
|
+
event: "valueChanged",
|
|
133
|
+
listener: (
|
|
134
|
+
changed: IDirectoryValueChanged,
|
|
135
|
+
local: boolean,
|
|
136
|
+
target: IEventThisPlaceHolder,
|
|
137
|
+
) => void,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Emitted when the {@link ISharedDirectory} is cleared.
|
|
142
|
+
*
|
|
143
|
+
* @remarks Listener parameters:
|
|
144
|
+
*
|
|
145
|
+
* - `local` - Whether the clear originated from this client.
|
|
146
|
+
*
|
|
147
|
+
* - `target` - The {@link ISharedDirectory} itself.
|
|
148
|
+
*/
|
|
149
|
+
(event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void);
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Emitted when a subdirectory is created.
|
|
153
|
+
*
|
|
154
|
+
* @remarks Listener parameters:
|
|
155
|
+
*
|
|
156
|
+
* - `path` - The relative path to the subdirectory that is created.
|
|
157
|
+
* It is relative from the object which raises the event.
|
|
158
|
+
*
|
|
159
|
+
* - `local` - Whether the create originated from the this client.
|
|
160
|
+
*
|
|
161
|
+
* - `target` - The {@link ISharedDirectory} itself.
|
|
162
|
+
*/
|
|
163
|
+
(
|
|
164
|
+
event: "subDirectoryCreated",
|
|
165
|
+
listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Emitted when a subdirectory is deleted.
|
|
170
|
+
*
|
|
171
|
+
* @remarks Listener parameters:
|
|
172
|
+
*
|
|
173
|
+
* - `path` - The relative path to the subdirectory that is deleted.
|
|
174
|
+
* It is relative from the object which raises the event.
|
|
175
|
+
*
|
|
176
|
+
* - `local` - Whether the delete originated from the this client.
|
|
177
|
+
*
|
|
178
|
+
* - `target` - The {@link ISharedDirectory} itself.
|
|
179
|
+
*/
|
|
180
|
+
(
|
|
181
|
+
event: "subDirectoryDeleted",
|
|
182
|
+
listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
183
|
+
);
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
/**
|
|
181
187
|
* Events emitted in response to changes to the directory data.
|
|
182
188
|
*/
|
|
183
189
|
export interface IDirectoryEvents extends IEvent {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
* @remarks Listener parameters:
|
|
257
|
-
*
|
|
258
|
-
* - `target` - The {@link IDirectory} itself.
|
|
259
|
-
*/
|
|
260
|
-
(event: "undisposed", listener: (
|
|
261
|
-
target: IEventThisPlaceHolder,
|
|
262
|
-
) => void);
|
|
190
|
+
/**
|
|
191
|
+
* Emitted when a key is set or deleted. As opposed to the
|
|
192
|
+
* {@link SharedDirectory}'s valueChanged event, this is emitted only on the {@link IDirectory} that directly
|
|
193
|
+
* contains the key.
|
|
194
|
+
*
|
|
195
|
+
* @remarks Listener parameters:
|
|
196
|
+
*
|
|
197
|
+
* - `changed` - Information on the key that changed and its value prior to the change.
|
|
198
|
+
*
|
|
199
|
+
* - `local` - Whether the change originated from this client.
|
|
200
|
+
*
|
|
201
|
+
* - `target` - The {@link IDirectory} itself.
|
|
202
|
+
*/
|
|
203
|
+
(
|
|
204
|
+
event: "containedValueChanged",
|
|
205
|
+
listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Emitted when a subdirectory is created. Also emitted when a delete
|
|
210
|
+
* of a subdirectory is rolled back.
|
|
211
|
+
*
|
|
212
|
+
* @remarks Listener parameters:
|
|
213
|
+
*
|
|
214
|
+
* - `path` - The relative path to the subdirectory that is created.
|
|
215
|
+
* It is relative from the object which raises the event.
|
|
216
|
+
*
|
|
217
|
+
* - `local` - Whether the creation originated from the this client.
|
|
218
|
+
*
|
|
219
|
+
* - `target` - The {@link ISharedDirectory} itself.
|
|
220
|
+
*/
|
|
221
|
+
(
|
|
222
|
+
event: "subDirectoryCreated",
|
|
223
|
+
listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Emitted when a subdirectory is deleted.
|
|
228
|
+
*
|
|
229
|
+
* @remarks Listener parameters:
|
|
230
|
+
*
|
|
231
|
+
* - `path` - The relative path to the subdirectory that is deleted.
|
|
232
|
+
* It is relative from the object which raises the event.
|
|
233
|
+
*
|
|
234
|
+
* - `local` - Whether the delete originated from the this client.
|
|
235
|
+
*
|
|
236
|
+
* - `target` - The {@link ISharedDirectory} itself.
|
|
237
|
+
*/
|
|
238
|
+
(
|
|
239
|
+
event: "subDirectoryDeleted",
|
|
240
|
+
listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Emitted when this sub directory is deleted.
|
|
245
|
+
*
|
|
246
|
+
* @remarks Listener parameters:
|
|
247
|
+
*
|
|
248
|
+
* - `target` - The {@link IDirectory} itself.
|
|
249
|
+
*/
|
|
250
|
+
(event: "disposed", listener: (target: IEventThisPlaceHolder) => void);
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Emitted when this previously deleted sub directory is restored.
|
|
254
|
+
* This event only needs to be handled in the case of rollback. If your application does
|
|
255
|
+
* not use the local rollback feature, you can ignore this event.
|
|
256
|
+
*
|
|
257
|
+
* @remarks Listener parameters:
|
|
258
|
+
*
|
|
259
|
+
* - `target` - The {@link IDirectory} itself.
|
|
260
|
+
*/
|
|
261
|
+
(event: "undisposed", listener: (target: IEventThisPlaceHolder) => void);
|
|
263
262
|
}
|
|
264
263
|
|
|
265
264
|
/**
|
|
@@ -268,58 +267,56 @@ export interface IDirectoryEvents extends IEvent {
|
|
|
268
267
|
* SubDirectories can be retrieved for use as working directories.
|
|
269
268
|
*/
|
|
270
269
|
export interface ISharedDirectory
|
|
271
|
-
|
|
272
|
-
{
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
270
|
+
extends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,
|
|
271
|
+
Omit<IDirectory, "on" | "once" | "off"> {
|
|
272
|
+
// The Omit type excludes symbols, which we don't want to exclude. Adding them back here manually.
|
|
273
|
+
// https://github.com/microsoft/TypeScript/issues/31671
|
|
274
|
+
// TODO: Use `unknown` instead (breaking change).
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
276
|
+
[Symbol.iterator](): IterableIterator<[string, any]>;
|
|
277
|
+
readonly [Symbol.toStringTag]: string;
|
|
279
278
|
}
|
|
280
279
|
|
|
281
280
|
/**
|
|
282
281
|
* Type of "valueChanged" event parameter for {@link ISharedDirectory}
|
|
283
282
|
*/
|
|
284
283
|
export interface IDirectoryValueChanged extends IValueChanged {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
/**
|
|
285
|
+
* The absolute path to the IDirectory storing the key which changed.
|
|
286
|
+
*/
|
|
287
|
+
path: string;
|
|
289
288
|
}
|
|
290
289
|
|
|
291
290
|
/**
|
|
292
291
|
* Events emitted in response to changes to the {@link ISharedMap | map} data.
|
|
293
292
|
*/
|
|
294
293
|
export interface ISharedMapEvents extends ISharedObjectEvents {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
local: boolean,
|
|
322
|
-
target: IEventThisPlaceHolder) => void);
|
|
294
|
+
/**
|
|
295
|
+
* Emitted when a key is set or deleted.
|
|
296
|
+
*
|
|
297
|
+
* @remarks Listener parameters:
|
|
298
|
+
*
|
|
299
|
+
* - `changed` - Information on the key that changed and its value prior to the change.
|
|
300
|
+
*
|
|
301
|
+
* - `local` - Whether the change originated from this client.
|
|
302
|
+
*
|
|
303
|
+
* - `target` - The {@link ISharedMap} itself.
|
|
304
|
+
*/
|
|
305
|
+
(
|
|
306
|
+
event: "valueChanged",
|
|
307
|
+
listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,
|
|
308
|
+
);
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Emitted when the map is cleared.
|
|
312
|
+
*
|
|
313
|
+
* @remarks Listener parameters:
|
|
314
|
+
*
|
|
315
|
+
* - `local` - Whether the clear originated from this client.
|
|
316
|
+
*
|
|
317
|
+
* - `target` - The {@link ISharedMap} itself.
|
|
318
|
+
*/
|
|
319
|
+
(event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void);
|
|
323
320
|
}
|
|
324
321
|
|
|
325
322
|
/**
|
|
@@ -334,22 +331,22 @@ export interface ISharedMapEvents extends ISharedObjectEvents {
|
|
|
334
331
|
// TODO: Use `unknown` instead (breaking change).
|
|
335
332
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
336
333
|
export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
334
|
+
/**
|
|
335
|
+
* Retrieves the given key from the map if it exists.
|
|
336
|
+
* @param key - Key to retrieve from
|
|
337
|
+
* @returns The stored value, or undefined if the key is not set
|
|
338
|
+
*/
|
|
339
|
+
// TODO: Use `unknown` instead (breaking change).
|
|
340
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
341
|
+
get<T = any>(key: string): T | undefined;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Sets the value stored at key to the provided value.
|
|
345
|
+
* @param key - Key to set
|
|
346
|
+
* @param value - Value to set
|
|
347
|
+
* @returns The {@link ISharedMap} itself
|
|
348
|
+
*/
|
|
349
|
+
set<T = unknown>(key: string, value: T): this;
|
|
353
350
|
}
|
|
354
351
|
|
|
355
352
|
/**
|
|
@@ -376,31 +373,31 @@ export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string,
|
|
|
376
373
|
* @deprecated This type is legacy and deprecated.
|
|
377
374
|
*/
|
|
378
375
|
export interface ISerializableValue {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
376
|
+
/**
|
|
377
|
+
* A type annotation to help indicate how the value serializes.
|
|
378
|
+
*/
|
|
379
|
+
type: string;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* The JSONable representation of the value.
|
|
383
|
+
*/
|
|
384
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
385
|
+
value: any;
|
|
389
386
|
}
|
|
390
387
|
|
|
391
388
|
/**
|
|
392
389
|
* Serialized {@link ISerializableValue} counterpart.
|
|
393
390
|
*/
|
|
394
391
|
export interface ISerializedValue {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
392
|
+
/**
|
|
393
|
+
* A type annotation to help indicate how the value serializes.
|
|
394
|
+
*/
|
|
395
|
+
type: string;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* String representation of the value.
|
|
399
|
+
*
|
|
400
|
+
* @remarks Will be undefined if the original value was undefined.
|
|
401
|
+
*/
|
|
402
|
+
value: string | undefined;
|
|
406
403
|
}
|