@microsoft/live-share-react 1.0.2-preview.1 → 1.2.0-preview.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/bin/live-hooks/index.d.ts +1 -0
- package/bin/live-hooks/index.d.ts.map +1 -1
- package/bin/live-hooks/index.js +1 -0
- package/bin/live-hooks/index.js.map +1 -1
- package/bin/live-hooks/useLiveEvent.d.ts.map +1 -1
- package/bin/live-hooks/useLiveEvent.js +2 -2
- package/bin/live-hooks/useLiveEvent.js.map +1 -1
- package/bin/live-hooks/useLiveFollowMode.d.ts +23 -0
- package/bin/live-hooks/useLiveFollowMode.d.ts.map +1 -0
- package/bin/live-hooks/useLiveFollowMode.js +212 -0
- package/bin/live-hooks/useLiveFollowMode.js.map +1 -0
- package/bin/live-hooks/useLivePresence.d.ts +1 -2
- package/bin/live-hooks/useLivePresence.d.ts.map +1 -1
- package/bin/live-hooks/useLivePresence.js +4 -4
- package/bin/live-hooks/useLivePresence.js.map +1 -1
- package/bin/live-hooks/useLiveState.d.ts.map +1 -1
- package/bin/live-hooks/useLiveState.js +2 -2
- package/bin/live-hooks/useLiveState.js.map +1 -1
- package/bin/live-hooks/useLiveTimer.d.ts.map +1 -1
- package/bin/live-hooks/useLiveTimer.js +2 -2
- package/bin/live-hooks/useLiveTimer.js.map +1 -1
- package/bin/live-hooks/useMediaSynchronizer.d.ts.map +1 -1
- package/bin/live-hooks/useMediaSynchronizer.js +3 -1
- package/bin/live-hooks/useMediaSynchronizer.js.map +1 -1
- package/bin/types/ResultTypes.d.ts +128 -1
- package/bin/types/ResultTypes.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/live-hooks/index.ts +1 -0
- package/src/live-hooks/useLiveEvent.ts +4 -1
- package/src/live-hooks/useLiveFollowMode.ts +315 -0
- package/src/live-hooks/useLivePresence.ts +6 -3
- package/src/live-hooks/useLiveState.ts +8 -2
- package/src/live-hooks/useLiveTimer.ts +4 -1
- package/src/live-hooks/useMediaSynchronizer.ts +8 -2
- package/src/types/ResultTypes.ts +131 -0
package/src/types/ResultTypes.ts
CHANGED
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
LiveEvent,
|
|
11
11
|
LivePresence,
|
|
12
12
|
LiveTimer,
|
|
13
|
+
IFollowModeState,
|
|
14
|
+
FollowModePresenceUser,
|
|
15
|
+
LiveFollowMode,
|
|
13
16
|
} from "@microsoft/live-share";
|
|
14
17
|
import { InkingManager, LiveCanvas } from "@microsoft/live-share-canvas";
|
|
15
18
|
import {
|
|
@@ -45,6 +48,9 @@ export interface ILiveShareContainerResults extends IAzureContainerResults {
|
|
|
45
48
|
created: boolean;
|
|
46
49
|
}
|
|
47
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Return type of `useSharedMap` hook.
|
|
53
|
+
*/
|
|
48
54
|
export interface IUseSharedMapResults<TData> {
|
|
49
55
|
/**
|
|
50
56
|
* Stateful map of most recent values from `SharedMap`.
|
|
@@ -64,6 +70,9 @@ export interface IUseSharedMapResults<TData> {
|
|
|
64
70
|
sharedMap: SharedMap | undefined;
|
|
65
71
|
}
|
|
66
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Return type of `useLiveEvent` hook.
|
|
75
|
+
*/
|
|
67
76
|
export interface IUseLiveEventResults<TEvent = any> {
|
|
68
77
|
/**
|
|
69
78
|
* The most recent event that has been received in the session.
|
|
@@ -85,6 +94,9 @@ export interface IUseLiveEventResults<TEvent = any> {
|
|
|
85
94
|
liveEvent: LiveEvent | undefined;
|
|
86
95
|
}
|
|
87
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Return type of `useLiveTimer` hook.
|
|
99
|
+
*/
|
|
88
100
|
export interface IUseLiveTimerResults {
|
|
89
101
|
/**
|
|
90
102
|
* The current timer configuration.
|
|
@@ -116,6 +128,9 @@ export interface IUseLiveTimerResults {
|
|
|
116
128
|
pause: OnPauseTimerAction;
|
|
117
129
|
}
|
|
118
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Return type of `useLivePresence` hook.
|
|
133
|
+
*/
|
|
119
134
|
export interface IUseLivePresenceResults<TData extends object = object> {
|
|
120
135
|
/**
|
|
121
136
|
* The local user's presence object.
|
|
@@ -142,6 +157,9 @@ export interface IUseLivePresenceResults<TData extends object = object> {
|
|
|
142
157
|
updatePresence: OnUpdateLivePresenceAction<TData>;
|
|
143
158
|
}
|
|
144
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Return type of `useMediaSynchronizer` hook.
|
|
162
|
+
*/
|
|
145
163
|
export interface IUseMediaSynchronizerResults {
|
|
146
164
|
/**
|
|
147
165
|
* Stateful boolean on whether the session has an active suspension.
|
|
@@ -189,6 +207,9 @@ export interface IUseMediaSynchronizerResults {
|
|
|
189
207
|
mediaSynchronizer: MediaPlayerSynchronizer | undefined;
|
|
190
208
|
}
|
|
191
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Return type of `useLiveCanvas` hook.
|
|
212
|
+
*/
|
|
192
213
|
export interface IUseLiveCanvasResults {
|
|
193
214
|
/**
|
|
194
215
|
* Inking manager for the canvas, which is synchronized by `liveCanvas`. It is set when loaded and undefined while loading.
|
|
@@ -199,3 +220,113 @@ export interface IUseLiveCanvasResults {
|
|
|
199
220
|
*/
|
|
200
221
|
liveCanvas: LiveCanvas | undefined;
|
|
201
222
|
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Return type of `useLiveFollowMode` hook.
|
|
226
|
+
*/
|
|
227
|
+
export interface IUseLiveFollowModeResults<TData = any> {
|
|
228
|
+
/**
|
|
229
|
+
* Gets the current follow mode state.
|
|
230
|
+
*/
|
|
231
|
+
state: IFollowModeState<TData> | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* Local LivePresenceUser.
|
|
234
|
+
*/
|
|
235
|
+
localUser: FollowModePresenceUser<TData> | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* List of non-local user's presence objects.
|
|
238
|
+
*/
|
|
239
|
+
otherUsers: FollowModePresenceUser<TData>[];
|
|
240
|
+
/**
|
|
241
|
+
* List of all user's presence objects.
|
|
242
|
+
*/
|
|
243
|
+
allUsers: FollowModePresenceUser<TData>[];
|
|
244
|
+
/**
|
|
245
|
+
* LiveFollowMode DDS
|
|
246
|
+
*/
|
|
247
|
+
liveFollowMode: LiveFollowMode<TData> | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* Broadcast a new custom data value for the local user's current state.
|
|
250
|
+
*
|
|
251
|
+
* @remarks
|
|
252
|
+
* Each user has their own state value, though it will differ from what is shown in {@link state} depending on the value of {@link FollowModeType}.
|
|
253
|
+
* Will cause the user to become out of sync if another user is presenting or the local user is following another user.
|
|
254
|
+
* To see each user's state, use the {@link getUsers} API, or listen to "presenceChanged" updates.
|
|
255
|
+
*
|
|
256
|
+
* @param newValue the state value for the local user's presence record.
|
|
257
|
+
*
|
|
258
|
+
* @returns a void promise that resolves once the update event has been sent to the server.
|
|
259
|
+
*
|
|
260
|
+
* @throws error if initialization has not yet succeeded.
|
|
261
|
+
*/
|
|
262
|
+
update: (stateValue: TData) => Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Start presenting the local user's state.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* If another user is already presenting, the local user will take control of presenting from the previous presenter.
|
|
268
|
+
* To update the local user's state that both the local and remote users will reference, use the {@link update} function.
|
|
269
|
+
* This API will override any `followingUserId` value that was set through {@link followUser} until presenting has stopped.
|
|
270
|
+
* To stop presenting, use the {@link stopPresenting} API.
|
|
271
|
+
*
|
|
272
|
+
* @returns a void promise that resolves once the event has been sent to the server.
|
|
273
|
+
*
|
|
274
|
+
* @throws error if initialization has not yet succeeded.
|
|
275
|
+
* @throws error if the local user is already the presenter.
|
|
276
|
+
* @throws error if the local user does not have the required roles to present.
|
|
277
|
+
*/
|
|
278
|
+
startPresenting: () => Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Stop presenting the presenting user's current state.
|
|
281
|
+
*
|
|
282
|
+
* @remarks
|
|
283
|
+
* This API allows any user with valid roles to cancel presenting, though we generally recommend only allowing the active presenter to do so.
|
|
284
|
+
* To start presenting, use the {@link startPresenting} API.
|
|
285
|
+
*
|
|
286
|
+
* @returns a void promise that resolves once the event has been sent to the server.
|
|
287
|
+
*
|
|
288
|
+
* @throws error if initialization has not yet succeeded.
|
|
289
|
+
* @throws error if the local user does not have the required roles to stop presenting.
|
|
290
|
+
*/
|
|
291
|
+
stopPresenting: () => Promise<void>;
|
|
292
|
+
/**
|
|
293
|
+
* Temporarily stop following presenter/follower.
|
|
294
|
+
*
|
|
295
|
+
* @returns a void promise once the operation succeeds.
|
|
296
|
+
*
|
|
297
|
+
* @throws error if initialization has not yet succeeded.
|
|
298
|
+
*/
|
|
299
|
+
beginSuspension: () => Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Resume following presenter/follower.
|
|
302
|
+
*
|
|
303
|
+
* @returns a void promise once the operation succeeds.
|
|
304
|
+
*
|
|
305
|
+
* @throws error if initialization has not yet succeeded.
|
|
306
|
+
*/
|
|
307
|
+
endSuspension: () => Promise<void>;
|
|
308
|
+
/**
|
|
309
|
+
* Follows another user in the session.
|
|
310
|
+
*
|
|
311
|
+
* @remarks
|
|
312
|
+
* If another user is presenting, {@link state} will not reflect following this user until there is no longer a presenter.
|
|
313
|
+
*
|
|
314
|
+
* @param userId the userId for the user to follow.
|
|
315
|
+
*
|
|
316
|
+
* @returns a void promise that resolves once the event has been sent to the server.
|
|
317
|
+
*
|
|
318
|
+
* @throws error if initialization has not yet succeeded.
|
|
319
|
+
* @throws error if attempting to follow a user that is not recognized by this object's `LivePresence` instance.
|
|
320
|
+
* @throws error if the `userId` provided is equal to the local user's `userId`.
|
|
321
|
+
*/
|
|
322
|
+
followUser: (userId: string) => Promise<void>;
|
|
323
|
+
/**
|
|
324
|
+
* Stop following the currently following user.
|
|
325
|
+
*
|
|
326
|
+
* @returns a void promise that resolves once the event has been sent to the server.
|
|
327
|
+
*
|
|
328
|
+
* @throws error if initialization has not yet succeeded.
|
|
329
|
+
* @throws error if the user is not already following another user.
|
|
330
|
+
*/
|
|
331
|
+
stopFollowing: () => Promise<void>;
|
|
332
|
+
}
|