@microsoft/live-share-react 1.0.0-preview.10 → 1.0.0-preview.11
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/README.md +88 -21
- package/package.json +13 -9
- package/src/live-hooks/useLiveCanvas.ts +11 -19
- package/src/live-hooks/useLiveEvent.ts +1 -1
- package/src/live-hooks/useLivePresence.ts +10 -9
- package/src/shared-hooks/index.ts +0 -1
- package/src/types/ActionTypes.ts +1 -1
- package/bin/index.d.ts +0 -7
- package/bin/index.d.ts.map +0 -1
- package/bin/index.js +0 -7
- package/bin/index.js.map +0 -1
- package/bin/interfaces/LiveInterfaceExtensions.d.ts +0 -9
- package/bin/interfaces/LiveInterfaceExtensions.d.ts.map +0 -1
- package/bin/interfaces/LiveInterfaceExtensions.js +0 -6
- package/bin/interfaces/LiveInterfaceExtensions.js.map +0 -1
- package/bin/interfaces/index.d.ts +0 -2
- package/bin/interfaces/index.d.ts.map +0 -1
- package/bin/interfaces/index.js +0 -2
- package/bin/interfaces/index.js.map +0 -1
- package/bin/internal-hooks/index.d.ts +0 -2
- package/bin/internal-hooks/index.d.ts.map +0 -1
- package/bin/internal-hooks/index.js +0 -2
- package/bin/internal-hooks/index.js.map +0 -1
- package/bin/internal-hooks/useDynamicDDSRegistry.d.ts +0 -14
- package/bin/internal-hooks/useDynamicDDSRegistry.d.ts.map +0 -1
- package/bin/internal-hooks/useDynamicDDSRegistry.js +0 -142
- package/bin/internal-hooks/useDynamicDDSRegistry.js.map +0 -1
- package/bin/internal-hooks/useSharedStateRegistry.d.ts +0 -31
- package/bin/internal-hooks/useSharedStateRegistry.d.ts.map +0 -1
- package/bin/internal-hooks/useSharedStateRegistry.js +0 -100
- package/bin/internal-hooks/useSharedStateRegistry.js.map +0 -1
- package/bin/internal-hooks/useStateRef.d.ts +0 -7
- package/bin/internal-hooks/useStateRef.d.ts.map +0 -1
- package/bin/internal-hooks/useStateRef.js +0 -15
- package/bin/internal-hooks/useStateRef.js.map +0 -1
- package/bin/live-hooks/index.d.ts +0 -7
- package/bin/live-hooks/index.d.ts.map +0 -1
- package/bin/live-hooks/index.js +0 -7
- package/bin/live-hooks/index.js.map +0 -1
- package/bin/live-hooks/useLiveAICompletion.d.ts +0 -29
- package/bin/live-hooks/useLiveAICompletion.d.ts.map +0 -1
- package/bin/live-hooks/useLiveAICompletion.js +0 -186
- package/bin/live-hooks/useLiveAICompletion.js.map +0 -1
- package/bin/live-hooks/useLiveCanvas.d.ts +0 -28
- package/bin/live-hooks/useLiveCanvas.d.ts.map +0 -1
- package/bin/live-hooks/useLiveCanvas.js +0 -167
- package/bin/live-hooks/useLiveCanvas.js.map +0 -1
- package/bin/live-hooks/useLiveCoPilot.d.ts +0 -28
- package/bin/live-hooks/useLiveCoPilot.d.ts.map +0 -1
- package/bin/live-hooks/useLiveCoPilot.js +0 -178
- package/bin/live-hooks/useLiveCoPilot.js.map +0 -1
- package/bin/live-hooks/useLiveEvent.d.ts +0 -22
- package/bin/live-hooks/useLiveEvent.d.ts.map +0 -1
- package/bin/live-hooks/useLiveEvent.js +0 -86
- package/bin/live-hooks/useLiveEvent.js.map +0 -1
- package/bin/live-hooks/useLivePresence.d.ts +0 -26
- package/bin/live-hooks/useLivePresence.d.ts.map +0 -1
- package/bin/live-hooks/useLivePresence.js +0 -93
- package/bin/live-hooks/useLivePresence.js.map +0 -1
- package/bin/live-hooks/useLiveState.d.ts +0 -19
- package/bin/live-hooks/useLiveState.d.ts.map +0 -1
- package/bin/live-hooks/useLiveState.js +0 -61
- package/bin/live-hooks/useLiveState.js.map +0 -1
- package/bin/live-hooks/useLiveTimer.d.ts +0 -8
- package/bin/live-hooks/useLiveTimer.d.ts.map +0 -1
- package/bin/live-hooks/useLiveTimer.js +0 -132
- package/bin/live-hooks/useLiveTimer.js.map +0 -1
- package/bin/live-hooks/useMediaSynchronizer.d.ts +0 -23
- package/bin/live-hooks/useMediaSynchronizer.d.ts.map +0 -1
- package/bin/live-hooks/useMediaSynchronizer.js +0 -162
- package/bin/live-hooks/useMediaSynchronizer.js.map +0 -1
- package/bin/live-share-turbo/AzureTurboClient.d.ts +0 -39
- package/bin/live-share-turbo/AzureTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/AzureTurboClient.js +0 -56
- package/bin/live-share-turbo/AzureTurboClient.js.map +0 -1
- package/bin/live-share-turbo/LiveShareTurboClient.d.ts +0 -53
- package/bin/live-share-turbo/LiveShareTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/LiveShareTurboClient.js +0 -69
- package/bin/live-share-turbo/LiveShareTurboClient.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts +0 -31
- package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboDataObject.js +0 -75
- package/bin/live-share-turbo/dds-objects/TurboDataObject.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts +0 -48
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js +0 -104
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts +0 -28
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js +0 -68
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts +0 -60
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js +0 -111
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts +0 -77
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.js +0 -137
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts +0 -30
- package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveState.js +0 -74
- package/bin/live-share-turbo/dds-objects/TurboLiveState.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts +0 -61
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.js +0 -108
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/index.d.ts +0 -8
- package/bin/live-share-turbo/dds-objects/index.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/index.js +0 -8
- package/bin/live-share-turbo/dds-objects/index.js.map +0 -1
- package/bin/live-share-turbo/index.d.ts +0 -5
- package/bin/live-share-turbo/index.d.ts.map +0 -1
- package/bin/live-share-turbo/index.js +0 -5
- package/bin/live-share-turbo/index.js.map +0 -1
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts +0 -15
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.js +0 -2
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.js.map +0 -1
- package/bin/live-share-turbo/interfaces/index.d.ts +0 -3
- package/bin/live-share-turbo/interfaces/index.d.ts.map +0 -1
- package/bin/live-share-turbo/interfaces/index.js +0 -3
- package/bin/live-share-turbo/interfaces/index.js.map +0 -1
- package/bin/live-share-turbo/internals/FluidTurboClient.d.ts +0 -39
- package/bin/live-share-turbo/internals/FluidTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/internals/FluidTurboClient.js +0 -121
- package/bin/live-share-turbo/internals/FluidTurboClient.js.map +0 -1
- package/bin/live-share-turbo/internals/index.d.ts +0 -2
- package/bin/live-share-turbo/internals/index.d.ts.map +0 -1
- package/bin/live-share-turbo/internals/index.js +0 -2
- package/bin/live-share-turbo/internals/index.js.map +0 -1
- package/bin/live-share-turbo/internals/types.d.ts +0 -4
- package/bin/live-share-turbo/internals/types.d.ts.map +0 -1
- package/bin/live-share-turbo/internals/types.js +0 -2
- package/bin/live-share-turbo/internals/types.js.map +0 -1
- package/bin/providers/AzureProvider.d.ts +0 -34
- package/bin/providers/AzureProvider.d.ts.map +0 -1
- package/bin/providers/AzureProvider.js +0 -102
- package/bin/providers/AzureProvider.js.map +0 -1
- package/bin/providers/FluidContextProvider.d.ts +0 -34
- package/bin/providers/FluidContextProvider.d.ts.map +0 -1
- package/bin/providers/FluidContextProvider.js +0 -99
- package/bin/providers/FluidContextProvider.js.map +0 -1
- package/bin/providers/LiveShareContextProvider.d.ts +0 -42
- package/bin/providers/LiveShareContextProvider.d.ts.map +0 -1
- package/bin/providers/LiveShareContextProvider.js +0 -63
- package/bin/providers/LiveShareContextProvider.js.map +0 -1
- package/bin/providers/LiveShareProvider.d.ts +0 -42
- package/bin/providers/LiveShareProvider.d.ts.map +0 -1
- package/bin/providers/LiveShareProvider.js +0 -66
- package/bin/providers/LiveShareProvider.js.map +0 -1
- package/bin/providers/index.d.ts +0 -3
- package/bin/providers/index.d.ts.map +0 -1
- package/bin/providers/index.js +0 -3
- package/bin/providers/index.js.map +0 -1
- package/bin/shared-hooks/index.d.ts +0 -5
- package/bin/shared-hooks/index.d.ts.map +0 -1
- package/bin/shared-hooks/index.js +0 -5
- package/bin/shared-hooks/index.js.map +0 -1
- package/bin/shared-hooks/useDynamicDDS.d.ts +0 -19
- package/bin/shared-hooks/useDynamicDDS.d.ts.map +0 -1
- package/bin/shared-hooks/useDynamicDDS.js +0 -68
- package/bin/shared-hooks/useDynamicDDS.js.map +0 -1
- package/bin/shared-hooks/useLockedTask.d.ts +0 -11
- package/bin/shared-hooks/useLockedTask.d.ts.map +0 -1
- package/bin/shared-hooks/useLockedTask.js +0 -82
- package/bin/shared-hooks/useLockedTask.js.map +0 -1
- package/bin/shared-hooks/useSharedMap.d.ts +0 -22
- package/bin/shared-hooks/useSharedMap.d.ts.map +0 -1
- package/bin/shared-hooks/useSharedMap.js +0 -106
- package/bin/shared-hooks/useSharedMap.js.map +0 -1
- package/bin/shared-hooks/useSharedState.d.ts +0 -21
- package/bin/shared-hooks/useSharedState.d.ts.map +0 -1
- package/bin/shared-hooks/useSharedState.js +0 -63
- package/bin/shared-hooks/useSharedState.js.map +0 -1
- package/bin/shared-hooks/useTaskManager.d.ts +0 -13
- package/bin/shared-hooks/useTaskManager.d.ts.map +0 -1
- package/bin/shared-hooks/useTaskManager.js +0 -86
- package/bin/shared-hooks/useTaskManager.js.map +0 -1
- package/bin/types/ActionTypes.d.ts +0 -30
- package/bin/types/ActionTypes.d.ts.map +0 -1
- package/bin/types/ActionTypes.js +0 -6
- package/bin/types/ActionTypes.js.map +0 -1
- package/bin/types/PropTypes.d.ts +0 -8
- package/bin/types/PropTypes.d.ts.map +0 -1
- package/bin/types/PropTypes.js +0 -6
- package/bin/types/PropTypes.js.map +0 -1
- package/bin/types/ResultTypes.d.ts +0 -163
- package/bin/types/ResultTypes.d.ts.map +0 -1
- package/bin/types/ResultTypes.js +0 -6
- package/bin/types/ResultTypes.js.map +0 -1
- package/bin/types/index.d.ts +0 -4
- package/bin/types/index.d.ts.map +0 -1
- package/bin/types/index.js +0 -4
- package/bin/types/index.js.map +0 -1
- package/bin/utils/getContainerSchema.d.ts +0 -8
- package/bin/utils/getContainerSchema.d.ts.map +0 -1
- package/bin/utils/getContainerSchema.js +0 -41
- package/bin/utils/getContainerSchema.js.map +0 -1
- package/bin/utils/index.d.ts +0 -2
- package/bin/utils/index.d.ts.map +0 -1
- package/bin/utils/index.js +0 -2
- package/bin/utils/index.js.map +0 -1
- package/bin/utils/type-check.d.ts +0 -15
- package/bin/utils/type-check.d.ts.map +0 -1
- package/bin/utils/type-check.js +0 -54
- package/bin/utils/type-check.js.map +0 -1
- package/src/shared-hooks/useTaskManager.ts +0 -82
- package/tinylicious.log +0 -4
package/README.md
CHANGED
|
@@ -48,13 +48,13 @@ export function SharedCheckbox() {
|
|
|
48
48
|
To add the latest version of the SDK to your application using NPM:
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
npm install @microsoft/live-share-react --save
|
|
51
|
+
npm install fluid-framework @fluidframework/azure-client @microsoft/live-share @microsoft/live-share-media @microsoft/live-share-canvas @microsoft/live-share-react --save
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
or using [Yarn](https://yarnpkg.com/):
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
yarn add @microsoft/live-share-react
|
|
57
|
+
yarn add fluid-framework @fluidframework/azure-client @microsoft/live-share @microsoft/live-share-media @microsoft/live-share-canvas @microsoft/live-share-react
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
### Building package
|
|
@@ -181,7 +181,7 @@ import { PresenceState } from "@microsoft/live-share";
|
|
|
181
181
|
export function OnlineUsers() {
|
|
182
182
|
const { localUser, allUsers, updatePresence } = useLivePresence(
|
|
183
183
|
"CUSTOM-USER-ID", // optional user id
|
|
184
|
-
{
|
|
184
|
+
{ favoriteColor: "red" } // optional custom data object
|
|
185
185
|
);
|
|
186
186
|
return (
|
|
187
187
|
<div>
|
|
@@ -190,16 +190,18 @@ export function OnlineUsers() {
|
|
|
190
190
|
{allUsers
|
|
191
191
|
.filter((user) => user.state === PresenceState.online)
|
|
192
192
|
.map((user) => (
|
|
193
|
-
<div key={user.userId}>
|
|
193
|
+
<div key={user.userId}>
|
|
194
|
+
{user.displayName + " " + user.data!.favoriteColor}
|
|
195
|
+
</div>
|
|
194
196
|
))}
|
|
195
197
|
</div>
|
|
196
198
|
<button
|
|
197
199
|
onClick={() => {
|
|
198
200
|
updatePresence(
|
|
201
|
+
localUser.data,
|
|
199
202
|
localUser?.state === PresenceState.offline
|
|
200
203
|
? PresenceState.online
|
|
201
204
|
: PresenceState.offline,
|
|
202
|
-
localUser.data
|
|
203
205
|
);
|
|
204
206
|
}}
|
|
205
207
|
>
|
|
@@ -479,25 +481,89 @@ Implementations may vary for each dynamic object & hook. We will try and update
|
|
|
479
481
|
|
|
480
482
|
Example:
|
|
481
483
|
|
|
482
|
-
```
|
|
483
|
-
import
|
|
484
|
+
```typescript
|
|
485
|
+
import React from "react";
|
|
484
486
|
import { useDynamicDDS } from "@microsoft/live-share-react";
|
|
485
|
-
import {
|
|
486
|
-
import {
|
|
487
|
-
|
|
488
|
-
// Register
|
|
489
|
-
DynamicObjectRegistry.registerObjectClass(
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
487
|
+
import { DynamicObjectRegistry } from "@microsoft/live-share";
|
|
488
|
+
import { TaskManager } from "@fluid-experimental/task-manager";
|
|
489
|
+
|
|
490
|
+
// Register TaskManager as dynamic object
|
|
491
|
+
DynamicObjectRegistry.registerObjectClass(TaskManager, TaskManager.getFactory().type);
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* A hook for joining a queue to lock tasks for a given id. Guaranteed to have only one user assigned to a task at a time.
|
|
495
|
+
*
|
|
496
|
+
* @param uniqueKey the unique key for the TaskManager DDS
|
|
497
|
+
* @param taskId the task id to lock
|
|
498
|
+
* @returns stateful data about the status of the task lock
|
|
499
|
+
*/
|
|
500
|
+
export const useTaskManager = (uniqueKey: string, taskId?: string): {
|
|
501
|
+
lockedTask: boolean;
|
|
502
|
+
taskManager: TaskManager | undefined;
|
|
503
|
+
} => {
|
|
504
|
+
/**
|
|
505
|
+
* TaskId currently in queue for
|
|
506
|
+
*/
|
|
507
|
+
const currentTaskIdRef = React.useRef<string | undefined>(undefined);
|
|
508
|
+
/**
|
|
509
|
+
* Stateful boolean that is true when the user is currently assigned the task
|
|
510
|
+
*/
|
|
511
|
+
const [lockedTask, setLockedTask] = React.useState<boolean>(false);
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* User facing: dynamically load the TaskManager DDS for the given unique key.
|
|
515
|
+
*/
|
|
516
|
+
const { dds: taskManager } = useDynamicDDS<TaskManager>(uniqueKey, TaskManager);
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* When the task id changes, lock the task. When the task id is undefined, abandon the task.
|
|
520
|
+
*/
|
|
521
|
+
React.useEffect(() => {
|
|
522
|
+
let mounted = true;
|
|
523
|
+
if (taskManager) {
|
|
524
|
+
if (taskId && currentTaskIdRef.current !== taskId) {
|
|
525
|
+
if (currentTaskIdRef.current) {
|
|
526
|
+
taskManager.abandon(currentTaskIdRef.current);
|
|
527
|
+
setLockedTask(false);
|
|
528
|
+
}
|
|
529
|
+
currentTaskIdRef.current = taskId;
|
|
530
|
+
const onLockTask = async () => {
|
|
531
|
+
try {
|
|
532
|
+
await taskManager.lockTask(taskId);
|
|
533
|
+
if (mounted) {
|
|
534
|
+
setLockedTask(true);
|
|
535
|
+
}
|
|
536
|
+
} catch {
|
|
537
|
+
if (mounted) {
|
|
538
|
+
setLockedTask(false);
|
|
539
|
+
currentTaskIdRef.current = undefined;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
onLockTask();
|
|
544
|
+
} else if (!taskId && currentTaskIdRef.current) {
|
|
545
|
+
taskManager.abandon(currentTaskIdRef.current);
|
|
546
|
+
setLockedTask(false);
|
|
547
|
+
currentTaskIdRef.current = undefined;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* When the component unmounts, abandon the task if it is still locked
|
|
552
|
+
*/
|
|
553
|
+
return () => {
|
|
554
|
+
mounted = false;
|
|
555
|
+
if (currentTaskIdRef.current) {
|
|
556
|
+
taskManager?.abandon(currentTaskIdRef.current);
|
|
557
|
+
}
|
|
558
|
+
currentTaskIdRef.current = undefined;
|
|
559
|
+
}
|
|
560
|
+
}, [taskManager, taskId]);
|
|
561
|
+
|
|
497
562
|
return {
|
|
498
|
-
|
|
563
|
+
lockedTask,
|
|
564
|
+
taskManager,
|
|
499
565
|
};
|
|
500
|
-
}
|
|
566
|
+
};
|
|
501
567
|
```
|
|
502
568
|
|
|
503
569
|
## Code samples
|
|
@@ -518,6 +584,7 @@ The Live Share SDK contains dependencies for [@microsoft/teams-js](https://www.n
|
|
|
518
584
|
|
|
519
585
|
| @microsoft/live-share | @microsoft/teams-js | fluid-framework | @microsoft/live-share-\* | @fluidframework/azure-client | @microsoft/TeamsFx | @microsoft/TeamsFx-react |
|
|
520
586
|
| --------------------- | -------------------- | --------------- | -------------------------- | ---------------------------- | ------------------------------- | ------------------------------- |
|
|
587
|
+
| 1.0.0-preview.11 | ^2.11.0 | ^1.2.3 | 1.0.0-preview.11 (optional) | ^1.0.0 (optional) | ^2.5.0 (optional) | ^2.5.0 (optional) |
|
|
521
588
|
| 1.0.0-preview.10 | ^2.10.1 | ~1.2.3 | 1.0.0-preview.10 (optional) | ~1.0.2 (optional) | ^2.5.0 (optional) | ^2.5.0 (optional) |
|
|
522
589
|
| 1.0.0-preview.8 | ^2.5.0 | ~1.2.3 | 1.0.0-preview.10 (optional) | ~1.0.2 (optional) | ^2.5.0 (optional) | ^2.5.0 (optional) |
|
|
523
590
|
| 1.0.0-preview.3 | 2.0.0-experimental.1 | ~1.2.3 | 1.0.0-preview.3 (optional) | ~1.0.2 (optional) | 2.0.0-experimental.0 (optional) | 2.0.0-experimental.0 (optional) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/live-share-react",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.11",
|
|
4
4
|
"description": "Build collaborative React apps using Microsoft's Fluid & Live Share frameworks with ease.",
|
|
5
5
|
"author": "Microsoft",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -12,26 +12,30 @@
|
|
|
12
12
|
"typecheck": "tsc"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@fluid-experimental/task-manager": "~1.2.3",
|
|
17
|
-
"@microsoft/live-share": "1.0.0-preview.10",
|
|
18
|
-
"@microsoft/live-share-canvas": "1.0.0-preview.10",
|
|
19
|
-
"@microsoft/live-share-media": "1.0.0-preview.10",
|
|
20
|
-
"@microsoft/live-share-turbo": "1.0.0-preview.10",
|
|
21
|
-
"fluid-framework": "~1.2.3",
|
|
15
|
+
"@microsoft/live-share-turbo": "1.0.0-preview.11",
|
|
22
16
|
"url": "^0.11.0",
|
|
23
17
|
"uuid": "^8.3.2"
|
|
24
18
|
},
|
|
25
19
|
"devDependencies": {
|
|
26
20
|
"@babel/core": "^7.12.3",
|
|
27
|
-
"@fluidframework/
|
|
21
|
+
"@fluidframework/azure-client": "~1.0.3",
|
|
22
|
+
"@fluidframework/test-client-utils": "^1.3.6",
|
|
23
|
+
"@microsoft/live-share": "1.0.0-preview.11",
|
|
24
|
+
"@microsoft/live-share-canvas": "1.0.0-preview.11",
|
|
25
|
+
"@microsoft/live-share-media": "1.0.0-preview.11",
|
|
28
26
|
"@types/react": "^18.0.0",
|
|
29
27
|
"@types/react-dom": "^18.0.0",
|
|
30
28
|
"@types/uuid": "^8.3.4",
|
|
31
29
|
"babel-loader": "^7.1.5",
|
|
30
|
+
"fluid-framework": "^1.3.6",
|
|
32
31
|
"typescript": "^4.6.4"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
34
|
+
"@fluidframework/azure-client": "^1.0.0",
|
|
35
|
+
"@microsoft/live-share": "1.0.0-preview.11",
|
|
36
|
+
"@microsoft/live-share-canvas": "1.0.0-preview.11",
|
|
37
|
+
"@microsoft/live-share-media": "1.0.0-preview.11",
|
|
38
|
+
"fluid-framework": "^1.2.3",
|
|
35
39
|
"react": "^16.8.0 || ^17 || ^18",
|
|
36
40
|
"react-dom": "^16.8.0 || ^17 || ^18"
|
|
37
41
|
},
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
InkingManager,
|
|
10
10
|
InkingTool,
|
|
11
11
|
IPoint,
|
|
12
|
-
IUserInfo,
|
|
13
12
|
LiveCanvas,
|
|
14
13
|
} from "@microsoft/live-share-canvas";
|
|
15
14
|
import React from "react";
|
|
@@ -33,7 +32,7 @@ import { isRefObject } from "../utils";
|
|
|
33
32
|
* @param scale Optional. Stateful scale number to use in the `InkingManager`. Defaults to 1 and must be greater than 0.
|
|
34
33
|
* @param referencePoint Optional. Stateful reference point enum to use in the `InkingManger`. Defaults to "center".
|
|
35
34
|
* @param isCursorShared Optional. Stateful boolean flag for whether cursor should be shared in `LiveCanvas`. Defaults to false.
|
|
36
|
-
* @param
|
|
35
|
+
* @param localUserPictureUrl Optional. url string for the local user to display alongside their cursor. Defaults to undefined.
|
|
37
36
|
* @returns IUseLiveCanvasResults object that contains the `liveCanvas` data object and `inkingManager`.
|
|
38
37
|
*/
|
|
39
38
|
export function useLiveCanvas(
|
|
@@ -46,7 +45,7 @@ export function useLiveCanvas(
|
|
|
46
45
|
scale?: number,
|
|
47
46
|
referencePoint?: CanvasReferencePoint,
|
|
48
47
|
isCursorShared?: boolean,
|
|
49
|
-
|
|
48
|
+
localUserPictureUrl?: string
|
|
50
49
|
): IUseLiveCanvasResults {
|
|
51
50
|
/**
|
|
52
51
|
* User facing: inking manager instance
|
|
@@ -56,7 +55,10 @@ export function useLiveCanvas(
|
|
|
56
55
|
/**
|
|
57
56
|
* User facing: dynamically load the DDS for the given unique key.
|
|
58
57
|
*/
|
|
59
|
-
const { dds: liveCanvas } = useDynamicDDS<LiveCanvas>(
|
|
58
|
+
const { dds: liveCanvas } = useDynamicDDS<LiveCanvas>(
|
|
59
|
+
uniqueKey,
|
|
60
|
+
LiveCanvas
|
|
61
|
+
);
|
|
60
62
|
|
|
61
63
|
/**
|
|
62
64
|
* Setup the InkingManager and LiveCanvas
|
|
@@ -162,10 +164,7 @@ export function useLiveCanvas(
|
|
|
162
164
|
* Sets the isCursorShared of the liveCanvas based on the 'isCursorShared' prop
|
|
163
165
|
*/
|
|
164
166
|
React.useEffect(() => {
|
|
165
|
-
if (
|
|
166
|
-
liveCanvas &&
|
|
167
|
-
isCursorShared !== undefined
|
|
168
|
-
) {
|
|
167
|
+
if (liveCanvas && isCursorShared !== undefined) {
|
|
169
168
|
liveCanvas.isCursorShared = isCursorShared;
|
|
170
169
|
}
|
|
171
170
|
}, [isCursorShared, liveCanvas]);
|
|
@@ -174,19 +173,12 @@ export function useLiveCanvas(
|
|
|
174
173
|
* Sets the onGetLocalUserInfo method of the liveCanvas based on the 'localUserCursor' prop
|
|
175
174
|
*/
|
|
176
175
|
React.useEffect(() => {
|
|
177
|
-
if (liveCanvas &&
|
|
178
|
-
liveCanvas.
|
|
179
|
-
return
|
|
180
|
-
displayName: localUserCursor.displayName,
|
|
181
|
-
pictureUri: localUserCursor.pictureUri,
|
|
182
|
-
};
|
|
176
|
+
if (liveCanvas && localUserPictureUrl) {
|
|
177
|
+
liveCanvas.onGetLocalUserPictureUrl = (): string | undefined => {
|
|
178
|
+
return localUserPictureUrl;
|
|
183
179
|
};
|
|
184
180
|
}
|
|
185
|
-
}, [
|
|
186
|
-
localUserCursor?.displayName,
|
|
187
|
-
localUserCursor?.pictureUri,
|
|
188
|
-
liveCanvas,
|
|
189
|
-
]);
|
|
181
|
+
}, [localUserPictureUrl, liveCanvas]);
|
|
190
182
|
|
|
191
183
|
/**
|
|
192
184
|
* Return hook response
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
LivePresence,
|
|
10
10
|
} from "@microsoft/live-share";
|
|
11
11
|
import React from "react";
|
|
12
|
-
import { IUseLivePresenceResults } from "../types";
|
|
12
|
+
import { IUseLivePresenceResults, OnUpdateLivePresenceAction } from "../types";
|
|
13
13
|
import { useDynamicDDS } from "../shared-hooks";
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -31,7 +31,6 @@ import { useDynamicDDS } from "../shared-hooks";
|
|
|
31
31
|
* to update the local user's presence and the `LivePresence` Fluid object.
|
|
32
32
|
*/
|
|
33
33
|
export function useLivePresence<TData extends object = object>(
|
|
34
|
-
userId?: string | undefined,
|
|
35
34
|
initialData?: TData | undefined,
|
|
36
35
|
initialPresenceState: PresenceState = PresenceState.online,
|
|
37
36
|
uniqueKey: string = ":<dds-default>"
|
|
@@ -45,7 +44,10 @@ export function useLivePresence<TData extends object = object>(
|
|
|
45
44
|
/**
|
|
46
45
|
* User facing: dynamically load the DDS for the given unique key.
|
|
47
46
|
*/
|
|
48
|
-
const { dds: livePresence } = useDynamicDDS<LivePresence<TData>>(
|
|
47
|
+
const { dds: livePresence } = useDynamicDDS<LivePresence<TData>>(
|
|
48
|
+
uniqueKey,
|
|
49
|
+
LivePresence<TData>
|
|
50
|
+
);
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
53
|
* User facing: list of non-local user's presence objects.
|
|
@@ -64,8 +66,8 @@ export function useLivePresence<TData extends object = object>(
|
|
|
64
66
|
/**
|
|
65
67
|
* User facing: callback to update the local user's presence.
|
|
66
68
|
*/
|
|
67
|
-
const updatePresence = React.useCallback(
|
|
68
|
-
(
|
|
69
|
+
const updatePresence: OnUpdateLivePresenceAction<TData> = React.useCallback(
|
|
70
|
+
(data?: TData | undefined, state?: PresenceState | undefined) => {
|
|
69
71
|
if (!livePresence) {
|
|
70
72
|
console.error(
|
|
71
73
|
new Error(
|
|
@@ -82,7 +84,7 @@ export function useLivePresence<TData extends object = object>(
|
|
|
82
84
|
);
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
|
-
livePresence.
|
|
87
|
+
livePresence.update(data, state);
|
|
86
88
|
},
|
|
87
89
|
[livePresence]
|
|
88
90
|
);
|
|
@@ -91,8 +93,7 @@ export function useLivePresence<TData extends object = object>(
|
|
|
91
93
|
* Setup change listeners and start `LivePresence` if needed
|
|
92
94
|
*/
|
|
93
95
|
React.useEffect(() => {
|
|
94
|
-
if (livePresence === undefined)
|
|
95
|
-
return;
|
|
96
|
+
if (livePresence === undefined) return;
|
|
96
97
|
|
|
97
98
|
const onPresenceChanged = () => {
|
|
98
99
|
const updatedLocalUsers: LivePresenceUser<TData>[] = [];
|
|
@@ -104,7 +105,7 @@ export function useLivePresence<TData extends object = object>(
|
|
|
104
105
|
livePresence.on("presenceChanged", onPresenceChanged);
|
|
105
106
|
|
|
106
107
|
if (!livePresence.isInitialized) {
|
|
107
|
-
livePresence.initialize(
|
|
108
|
+
livePresence.initialize(initialData, initialPresenceState);
|
|
108
109
|
} else {
|
|
109
110
|
onPresenceChanged();
|
|
110
111
|
}
|
package/src/types/ActionTypes.ts
CHANGED
|
@@ -56,8 +56,8 @@ export type OnReceivedLiveEventAction<TEvent> = (
|
|
|
56
56
|
) => void;
|
|
57
57
|
|
|
58
58
|
export type OnUpdateLivePresenceAction<TData extends object = object> = (
|
|
59
|
+
data?: TData | undefined,
|
|
59
60
|
state?: PresenceState | undefined,
|
|
60
|
-
data?: TData | undefined
|
|
61
61
|
) => void;
|
|
62
62
|
|
|
63
63
|
export type OnStartTimerAction = (
|
package/bin/index.d.ts
DELETED
package/bin/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/bin/index.js
DELETED
package/bin/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
export interface IReceiveLiveEvent<TEvent extends object = object> {
|
|
6
|
-
event: TEvent;
|
|
7
|
-
local: boolean;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=LiveInterfaceExtensions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiveInterfaceExtensions.d.ts","sourceRoot":"","sources":["../../src/interfaces/LiveInterfaceExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiveInterfaceExtensions.js","sourceRoot":"","sources":["../../src/interfaces/LiveInterfaceExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
package/bin/interfaces/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IAzureContainerResults, RegisterDDSSetStateAction, UnregisterDDSSetStateAction } from "../types";
|
|
2
|
-
export interface IDynamicDDSRegistry {
|
|
3
|
-
registerDDSSetStateAction: RegisterDDSSetStateAction;
|
|
4
|
-
unregisterDDSSetStateAction: UnregisterDDSSetStateAction;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Hook used internally to keep track of the DDSSetStateActionMap for each unique key. It gets DDS objects for provided keys where they exist and creates
|
|
8
|
-
* them where they do not, providing the DDS objects to components that use them.
|
|
9
|
-
*
|
|
10
|
-
* @param results IAzureContainerResults response or undefined
|
|
11
|
-
* @returns IDynamicDDSRegistry object
|
|
12
|
-
*/
|
|
13
|
-
export declare const useDynamicDDSRegistry: (results: IAzureContainerResults | undefined) => IDynamicDDSRegistry;
|
|
14
|
-
//# sourceMappingURL=useDynamicDDSRegistry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDynamicDDSRegistry.d.ts","sourceRoot":"","sources":["../../src/internal-hooks/useDynamicDDSRegistry.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,sBAAsB,EACtB,yBAAyB,EAEzB,2BAA2B,EAC9B,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,mBAAmB;IAChC,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,2BAA2B,EAAE,2BAA2B,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,YACrB,sBAAsB,GAAG,SAAS,KAC5C,mBAyKF,CAAC"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
11
|
-
/**
|
|
12
|
-
* Hook used internally to keep track of the DDSSetStateActionMap for each unique key. It gets DDS objects for provided keys where they exist and creates
|
|
13
|
-
* them where they do not, providing the DDS objects to components that use them.
|
|
14
|
-
*
|
|
15
|
-
* @param results IAzureContainerResults response or undefined
|
|
16
|
-
* @returns IDynamicDDSRegistry object
|
|
17
|
-
*/
|
|
18
|
-
export const useDynamicDDSRegistry = (results) => {
|
|
19
|
-
const registeredDDSSetStateActionMapRef = useRef(new Map());
|
|
20
|
-
// Get the DDS from dynamicObjects for a given key, if known
|
|
21
|
-
const getDDS = useCallback((key) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
const dynamicObjectMap = results === null || results === void 0 ? void 0 : results.container.initialObjects.dynamicObjects;
|
|
23
|
-
if (dynamicObjectMap) {
|
|
24
|
-
const handleValue = dynamicObjectMap.get(key);
|
|
25
|
-
if (handleValue) {
|
|
26
|
-
const dds = yield handleValue.get();
|
|
27
|
-
return dds;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
throw new Error("getDDS should never be called if dynamicObjects is undefined");
|
|
35
|
-
}
|
|
36
|
-
}), [results]);
|
|
37
|
-
// Create a new DDS of type T in dynamicObjects
|
|
38
|
-
const createDDS = useCallback((key, objectClass) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
-
const dynamicObjectMap = results === null || results === void 0 ? void 0 : results.container.initialObjects.dynamicObjects;
|
|
40
|
-
if (dynamicObjectMap) {
|
|
41
|
-
// Create a new DDS and set the handle to the DDS
|
|
42
|
-
const dds = yield results.container.create(objectClass);
|
|
43
|
-
dynamicObjectMap.set(key, dds.handle);
|
|
44
|
-
return dds;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
throw new Error("createDDS: should never be called if dynamicObjectsMap is undefined");
|
|
48
|
-
}
|
|
49
|
-
}), [results]);
|
|
50
|
-
// Callback for hooks (e.g., useSharedMap) to register a new set state action so they
|
|
51
|
-
// always have the most recent DDS. If one does not exist, we create it here.
|
|
52
|
-
const registerDDSSetStateAction = useCallback((uniqueKey, componentId, objectClass, setLocalStateAction, onDidFirstInitialize) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
let shouldCreateIfNeeded = false;
|
|
54
|
-
let actionsMap = registeredDDSSetStateActionMapRef.current.get(uniqueKey);
|
|
55
|
-
if (actionsMap) {
|
|
56
|
-
if (!actionsMap.has(componentId)) {
|
|
57
|
-
shouldCreateIfNeeded = true;
|
|
58
|
-
actionsMap.set(componentId, setLocalStateAction);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
shouldCreateIfNeeded = true;
|
|
63
|
-
actionsMap = new Map();
|
|
64
|
-
actionsMap.set(componentId, setLocalStateAction);
|
|
65
|
-
registeredDDSSetStateActionMapRef.current.set(uniqueKey, actionsMap);
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
// Set initial values, if known
|
|
69
|
-
let dds = yield getDDS(uniqueKey);
|
|
70
|
-
if (dds) {
|
|
71
|
-
setLocalStateAction(dds);
|
|
72
|
-
}
|
|
73
|
-
else if (shouldCreateIfNeeded) {
|
|
74
|
-
// Create a new DDS of type T
|
|
75
|
-
dds = yield createDDS(uniqueKey, objectClass);
|
|
76
|
-
setLocalStateAction(dds);
|
|
77
|
-
onDidFirstInitialize === null || onDidFirstInitialize === void 0 ? void 0 : onDidFirstInitialize(dds);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
throw error;
|
|
82
|
-
}
|
|
83
|
-
}), [results]);
|
|
84
|
-
// Callback for hooks (e.g., useSharedMap) to unregister their set state actions
|
|
85
|
-
const unregisterDDSSetStateAction = useCallback((uniqueKey, componentId) => {
|
|
86
|
-
let actionsMap = registeredDDSSetStateActionMapRef.current.get(uniqueKey);
|
|
87
|
-
if (actionsMap === null || actionsMap === void 0 ? void 0 : actionsMap.has(componentId)) {
|
|
88
|
-
actionsMap.delete(componentId);
|
|
89
|
-
}
|
|
90
|
-
}, []);
|
|
91
|
-
// Initial setup
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
if (!results)
|
|
94
|
-
return;
|
|
95
|
-
const { container } = results;
|
|
96
|
-
const dynamicObjectMap = container.initialObjects
|
|
97
|
-
.dynamicObjects;
|
|
98
|
-
// Register value changed listener
|
|
99
|
-
const valueChangedListener = (changed, local) => {
|
|
100
|
-
if (local)
|
|
101
|
-
return;
|
|
102
|
-
if (registeredDDSSetStateActionMapRef.current.has(changed.key)) {
|
|
103
|
-
const actionMap = registeredDDSSetStateActionMapRef.current.get(changed.key);
|
|
104
|
-
// Get the DDS for the changed value, if known
|
|
105
|
-
getDDS(changed.key)
|
|
106
|
-
.then((dds) => {
|
|
107
|
-
// Update each component that has registered an action in actionMap
|
|
108
|
-
actionMap === null || actionMap === void 0 ? void 0 : actionMap.forEach((setLocalStateHandler) => {
|
|
109
|
-
setLocalStateHandler(dds);
|
|
110
|
-
});
|
|
111
|
-
})
|
|
112
|
-
.catch((error) => console.error(error));
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
dynamicObjectMap.on("valueChanged", valueChangedListener);
|
|
116
|
-
// Set initial values
|
|
117
|
-
dynamicObjectMap.forEach((handleValue, key) => {
|
|
118
|
-
const actionMap = registeredDDSSetStateActionMapRef.current.get(key);
|
|
119
|
-
if (handleValue) {
|
|
120
|
-
handleValue
|
|
121
|
-
.get()
|
|
122
|
-
.then((dds) => {
|
|
123
|
-
// Update each component that has registered an action in actionMap
|
|
124
|
-
actionMap === null || actionMap === void 0 ? void 0 : actionMap.forEach((setLocalStateHandler) => {
|
|
125
|
-
setLocalStateHandler(dds);
|
|
126
|
-
});
|
|
127
|
-
})
|
|
128
|
-
.catch((error) => {
|
|
129
|
-
console.error(error);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
return () => {
|
|
134
|
-
dynamicObjectMap.off("valueChanged", valueChangedListener);
|
|
135
|
-
};
|
|
136
|
-
}, [results]);
|
|
137
|
-
return {
|
|
138
|
-
registerDDSSetStateAction,
|
|
139
|
-
unregisterDDSSetStateAction,
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
//# sourceMappingURL=useDynamicDDSRegistry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDynamicDDSRegistry.js","sourceRoot":"","sources":["../../src/internal-hooks/useDynamicDDSRegistry.ts"],"names":[],"mappings":";;;;;;;;;AAOA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAavD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACjC,OAA2C,EACxB,EAAE;IACrB,MAAM,iCAAiC,GAAG,MAAM,CAE9C,IAAI,GAAG,EAAE,CAAC,CAAC;IAEb,4DAA4D;IAC5D,MAAM,MAAM,GAAG,WAAW,CACtB,CACI,GAAW,EACW,EAAE;QACxB,MAAM,gBAAgB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,cAAc,CACrD,cAAuC,CAAC;QAC7C,IAAI,gBAAgB,EAAE;YAClB,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAEtC,GAAG,CAAC,CAAC;YACP,IAAI,WAAW,EAAE;gBACb,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC;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