@microsoft/live-share-react 1.3.0-preview.0 → 1.4.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/.nycrc.json +9 -9
- package/LICENSE +86 -86
- package/README.md +608 -608
- package/bin/live-hooks/useLiveEvent.d.ts.map +1 -1
- package/bin/live-hooks/useLiveEvent.js +6 -0
- package/bin/live-hooks/useLiveEvent.js.map +1 -1
- package/bin/live-hooks/useLiveFollowMode.d.ts.map +1 -1
- package/bin/live-hooks/useLiveFollowMode.js +2 -4
- package/bin/live-hooks/useLiveFollowMode.js.map +1 -1
- package/bin/live-hooks/useLivePresence.d.ts.map +1 -1
- package/bin/live-hooks/useLivePresence.js +1 -3
- 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 +1 -3
- 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 +4 -0
- package/bin/live-hooks/useLiveTimer.js.map +1 -1
- package/package.json +50 -50
- package/src/index.ts +6 -6
- package/src/interfaces/LiveInterfaceExtensions.ts +26 -26
- package/src/interfaces/index.ts +1 -1
- package/src/internal/errors.ts +57 -57
- package/src/internal/index.ts +2 -2
- package/src/internal/type-guards.ts +9 -9
- package/src/live-hooks/index.ts +7 -7
- package/src/live-hooks/useLiveCanvas.ts +191 -191
- package/src/live-hooks/useLiveEvent.ts +146 -140
- package/src/live-hooks/useLiveFollowMode.ts +315 -316
- package/src/live-hooks/useLivePresence.ts +146 -147
- package/src/live-hooks/useLiveState.ts +108 -110
- package/src/live-hooks/useLiveTimer.ts +217 -213
- package/src/live-hooks/useMediaSynchronizer.ts +295 -295
- package/src/providers/AzureProvider.tsx +261 -261
- package/src/providers/LiveShareProvider.tsx +210 -210
- package/src/providers/index.ts +2 -2
- package/src/shared-hooks/index.ts +4 -4
- package/src/shared-hooks/useDynamicDDS.ts +82 -82
- package/src/shared-hooks/useSharedMap.ts +159 -159
- package/src/shared-hooks/useSharedState.ts +96 -96
- package/src/shared-hooks/useSharedStateRegistry.ts +170 -170
- package/src/types/ActionTypes.ts +161 -161
- package/src/types/PropTypes.ts +10 -10
- package/src/types/ResultTypes.ts +332 -332
- package/src/types/index.ts +3 -3
- package/src/utils/index.ts +1 -1
- package/src/utils/type-check.ts +69 -69
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +72 -72
- package/bin/internal/useSharedStateRegistry.d.ts +0 -31
- package/bin/internal/useSharedStateRegistry.d.ts.map +0 -1
- package/bin/internal/useSharedStateRegistry.js +0 -102
- package/bin/internal/useSharedStateRegistry.js.map +0 -1
|
@@ -1,213 +1,217 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
ITimerConfig,
|
|
8
|
-
LiveTimerEvents,
|
|
9
|
-
UserMeetingRole,
|
|
10
|
-
LiveTimer,
|
|
11
|
-
LiveDataObjectInitializeState,
|
|
12
|
-
} from "@microsoft/live-share";
|
|
13
|
-
import React from "react";
|
|
14
|
-
import {
|
|
15
|
-
IUseLiveTimerResults,
|
|
16
|
-
OnPauseTimerAction,
|
|
17
|
-
OnPlayTimerAction,
|
|
18
|
-
OnStartTimerAction,
|
|
19
|
-
OnTimerDidFinishAction,
|
|
20
|
-
OnTimerDidPauseAction,
|
|
21
|
-
OnTimerDidPlayAction,
|
|
22
|
-
OnTimerDidStartAction,
|
|
23
|
-
OnTimerTickAction,
|
|
24
|
-
} from "../types";
|
|
25
|
-
import { useDynamicDDS } from "../shared-hooks";
|
|
26
|
-
import { useFluidObjectsContext } from "../providers";
|
|
27
|
-
import {
|
|
28
|
-
ActionContainerNotJoinedError,
|
|
29
|
-
ActionLiveDataObjectInitializedError,
|
|
30
|
-
ActionLiveDataObjectUndefinedError,
|
|
31
|
-
} from "../internal";
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* React hook for using Live Share's `LiveTimer` DDS.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* Use this hook to create a synchronized countdown timer in your app or to schedule synchronized tasks.
|
|
38
|
-
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
39
|
-
*
|
|
40
|
-
* @param uniqueKey the unique key for the `LiveTimer`. If one does not yet exist, a new one will be created, otherwise it will use the existing one.
|
|
41
|
-
* @param allowedRoles Optional. the user roles that are allowed to start/stop/pause the timer.
|
|
42
|
-
* @param tickRate Optional. the interval in which the `milliRemaining` state should be updated and the `onTick` callback will trigger.
|
|
43
|
-
* @param onTick Optional. event handler callback for when an active timer ticks.
|
|
44
|
-
* @param onStart Optional. event handler callback for when the timer is started.
|
|
45
|
-
* @param onPause Optional. event handler callback for when the timer is paused.
|
|
46
|
-
* @param onPlay Optional. event handler callback for when the timer is resumed.
|
|
47
|
-
* @param onFinish Optional. event handler callback for when the timer finishes.
|
|
48
|
-
* @returns results and callbacks exposed via the hook.
|
|
49
|
-
*/
|
|
50
|
-
export function useLiveTimer(
|
|
51
|
-
uniqueKey: string,
|
|
52
|
-
allowedRoles?: UserMeetingRole[],
|
|
53
|
-
tickRate?: number,
|
|
54
|
-
onTick?: OnTimerTickAction,
|
|
55
|
-
onStart?: OnTimerDidStartAction,
|
|
56
|
-
onPause?: OnTimerDidPauseAction,
|
|
57
|
-
onPlay?: OnTimerDidPlayAction,
|
|
58
|
-
onFinish?: OnTimerDidFinishAction
|
|
59
|
-
): IUseLiveTimerResults {
|
|
60
|
-
/**
|
|
61
|
-
* User facing: Stateful timer config.
|
|
62
|
-
*/
|
|
63
|
-
const [timerConfig, setTimerConfig] = React.useState<ITimerConfig>();
|
|
64
|
-
/**
|
|
65
|
-
* User facing: Stateful time remaining.
|
|
66
|
-
*/
|
|
67
|
-
const [milliRemaining, setMilliRemaining] = React.useState<number>();
|
|
68
|
-
/**
|
|
69
|
-
* User facing: dynamically load the DDS for the given unique key.
|
|
70
|
-
*/
|
|
71
|
-
const { dds: liveTimer } = useDynamicDDS<LiveTimer>(uniqueKey, LiveTimer);
|
|
72
|
-
|
|
73
|
-
const { container } = useFluidObjectsContext();
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Callback to send event through `LiveTimer`
|
|
77
|
-
* @param duration the duration for the timer in milliseconds
|
|
78
|
-
* @returns void promise that will throw when user does not have required roles
|
|
79
|
-
*/
|
|
80
|
-
const start: OnStartTimerAction = React.useCallback(
|
|
81
|
-
async (duration: number) => {
|
|
82
|
-
if (!container) {
|
|
83
|
-
throw new ActionContainerNotJoinedError("liveTimer", "start");
|
|
84
|
-
}
|
|
85
|
-
if (liveTimer === undefined) {
|
|
86
|
-
throw new ActionLiveDataObjectUndefinedError(
|
|
87
|
-
"liveTimer",
|
|
88
|
-
"start"
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
if (!liveTimer.isInitialized) {
|
|
92
|
-
throw new ActionLiveDataObjectInitializedError(
|
|
93
|
-
"liveTimer",
|
|
94
|
-
"start"
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
return await liveTimer.start(duration);
|
|
98
|
-
},
|
|
99
|
-
[container, liveTimer]
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Callback to send event through `LiveTimer`
|
|
104
|
-
* @returns void promise that will throw when user does not have required roles
|
|
105
|
-
*/
|
|
106
|
-
const play: OnPlayTimerAction = React.useCallback(async () => {
|
|
107
|
-
if (!container) {
|
|
108
|
-
throw new ActionContainerNotJoinedError("liveTimer", "play");
|
|
109
|
-
}
|
|
110
|
-
if (liveTimer === undefined) {
|
|
111
|
-
throw new ActionLiveDataObjectUndefinedError("liveTimer", "play");
|
|
112
|
-
}
|
|
113
|
-
if (!liveTimer.isInitialized) {
|
|
114
|
-
throw new ActionLiveDataObjectInitializedError("liveTimer", "play");
|
|
115
|
-
}
|
|
116
|
-
return await liveTimer.play();
|
|
117
|
-
}, [container, liveTimer]);
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Callback to send event through `LiveTimer`
|
|
121
|
-
* @returns void promise that will throw when user does not have required roles
|
|
122
|
-
*/
|
|
123
|
-
const pause: OnPauseTimerAction = React.useCallback(async () => {
|
|
124
|
-
if (!container) {
|
|
125
|
-
throw new ActionContainerNotJoinedError("liveTimer", "pause");
|
|
126
|
-
}
|
|
127
|
-
if (liveTimer === undefined) {
|
|
128
|
-
throw new ActionLiveDataObjectUndefinedError("liveTimer", "pause");
|
|
129
|
-
}
|
|
130
|
-
if (!liveTimer.isInitialized) {
|
|
131
|
-
throw new ActionLiveDataObjectInitializedError(
|
|
132
|
-
"liveTimer",
|
|
133
|
-
"pause"
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
return await liveTimer.pause();
|
|
137
|
-
}, [container, liveTimer]);
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Setup change listeners and start `LiveTimer` if needed
|
|
141
|
-
*/
|
|
142
|
-
React.useEffect(() => {
|
|
143
|
-
if (liveTimer === undefined) return;
|
|
144
|
-
//
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
};
|
|
162
|
-
const
|
|
163
|
-
onTimerConfigChange(config);
|
|
164
|
-
|
|
165
|
-
};
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
liveTimer.on(LiveTimerEvents.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
liveTimer?.off(LiveTimerEvents.
|
|
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
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ITimerConfig,
|
|
8
|
+
LiveTimerEvents,
|
|
9
|
+
UserMeetingRole,
|
|
10
|
+
LiveTimer,
|
|
11
|
+
LiveDataObjectInitializeState,
|
|
12
|
+
} from "@microsoft/live-share";
|
|
13
|
+
import React from "react";
|
|
14
|
+
import {
|
|
15
|
+
IUseLiveTimerResults,
|
|
16
|
+
OnPauseTimerAction,
|
|
17
|
+
OnPlayTimerAction,
|
|
18
|
+
OnStartTimerAction,
|
|
19
|
+
OnTimerDidFinishAction,
|
|
20
|
+
OnTimerDidPauseAction,
|
|
21
|
+
OnTimerDidPlayAction,
|
|
22
|
+
OnTimerDidStartAction,
|
|
23
|
+
OnTimerTickAction,
|
|
24
|
+
} from "../types";
|
|
25
|
+
import { useDynamicDDS } from "../shared-hooks";
|
|
26
|
+
import { useFluidObjectsContext } from "../providers";
|
|
27
|
+
import {
|
|
28
|
+
ActionContainerNotJoinedError,
|
|
29
|
+
ActionLiveDataObjectInitializedError,
|
|
30
|
+
ActionLiveDataObjectUndefinedError,
|
|
31
|
+
} from "../internal";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* React hook for using Live Share's `LiveTimer` DDS.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* Use this hook to create a synchronized countdown timer in your app or to schedule synchronized tasks.
|
|
38
|
+
* This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
|
|
39
|
+
*
|
|
40
|
+
* @param uniqueKey the unique key for the `LiveTimer`. If one does not yet exist, a new one will be created, otherwise it will use the existing one.
|
|
41
|
+
* @param allowedRoles Optional. the user roles that are allowed to start/stop/pause the timer.
|
|
42
|
+
* @param tickRate Optional. the interval in which the `milliRemaining` state should be updated and the `onTick` callback will trigger.
|
|
43
|
+
* @param onTick Optional. event handler callback for when an active timer ticks.
|
|
44
|
+
* @param onStart Optional. event handler callback for when the timer is started.
|
|
45
|
+
* @param onPause Optional. event handler callback for when the timer is paused.
|
|
46
|
+
* @param onPlay Optional. event handler callback for when the timer is resumed.
|
|
47
|
+
* @param onFinish Optional. event handler callback for when the timer finishes.
|
|
48
|
+
* @returns results and callbacks exposed via the hook.
|
|
49
|
+
*/
|
|
50
|
+
export function useLiveTimer(
|
|
51
|
+
uniqueKey: string,
|
|
52
|
+
allowedRoles?: UserMeetingRole[],
|
|
53
|
+
tickRate?: number,
|
|
54
|
+
onTick?: OnTimerTickAction,
|
|
55
|
+
onStart?: OnTimerDidStartAction,
|
|
56
|
+
onPause?: OnTimerDidPauseAction,
|
|
57
|
+
onPlay?: OnTimerDidPlayAction,
|
|
58
|
+
onFinish?: OnTimerDidFinishAction
|
|
59
|
+
): IUseLiveTimerResults {
|
|
60
|
+
/**
|
|
61
|
+
* User facing: Stateful timer config.
|
|
62
|
+
*/
|
|
63
|
+
const [timerConfig, setTimerConfig] = React.useState<ITimerConfig>();
|
|
64
|
+
/**
|
|
65
|
+
* User facing: Stateful time remaining.
|
|
66
|
+
*/
|
|
67
|
+
const [milliRemaining, setMilliRemaining] = React.useState<number>();
|
|
68
|
+
/**
|
|
69
|
+
* User facing: dynamically load the DDS for the given unique key.
|
|
70
|
+
*/
|
|
71
|
+
const { dds: liveTimer } = useDynamicDDS<LiveTimer>(uniqueKey, LiveTimer);
|
|
72
|
+
|
|
73
|
+
const { container } = useFluidObjectsContext();
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Callback to send event through `LiveTimer`
|
|
77
|
+
* @param duration the duration for the timer in milliseconds
|
|
78
|
+
* @returns void promise that will throw when user does not have required roles
|
|
79
|
+
*/
|
|
80
|
+
const start: OnStartTimerAction = React.useCallback(
|
|
81
|
+
async (duration: number) => {
|
|
82
|
+
if (!container) {
|
|
83
|
+
throw new ActionContainerNotJoinedError("liveTimer", "start");
|
|
84
|
+
}
|
|
85
|
+
if (liveTimer === undefined) {
|
|
86
|
+
throw new ActionLiveDataObjectUndefinedError(
|
|
87
|
+
"liveTimer",
|
|
88
|
+
"start"
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (!liveTimer.isInitialized) {
|
|
92
|
+
throw new ActionLiveDataObjectInitializedError(
|
|
93
|
+
"liveTimer",
|
|
94
|
+
"start"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return await liveTimer.start(duration);
|
|
98
|
+
},
|
|
99
|
+
[container, liveTimer]
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Callback to send event through `LiveTimer`
|
|
104
|
+
* @returns void promise that will throw when user does not have required roles
|
|
105
|
+
*/
|
|
106
|
+
const play: OnPlayTimerAction = React.useCallback(async () => {
|
|
107
|
+
if (!container) {
|
|
108
|
+
throw new ActionContainerNotJoinedError("liveTimer", "play");
|
|
109
|
+
}
|
|
110
|
+
if (liveTimer === undefined) {
|
|
111
|
+
throw new ActionLiveDataObjectUndefinedError("liveTimer", "play");
|
|
112
|
+
}
|
|
113
|
+
if (!liveTimer.isInitialized) {
|
|
114
|
+
throw new ActionLiveDataObjectInitializedError("liveTimer", "play");
|
|
115
|
+
}
|
|
116
|
+
return await liveTimer.play();
|
|
117
|
+
}, [container, liveTimer]);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Callback to send event through `LiveTimer`
|
|
121
|
+
* @returns void promise that will throw when user does not have required roles
|
|
122
|
+
*/
|
|
123
|
+
const pause: OnPauseTimerAction = React.useCallback(async () => {
|
|
124
|
+
if (!container) {
|
|
125
|
+
throw new ActionContainerNotJoinedError("liveTimer", "pause");
|
|
126
|
+
}
|
|
127
|
+
if (liveTimer === undefined) {
|
|
128
|
+
throw new ActionLiveDataObjectUndefinedError("liveTimer", "pause");
|
|
129
|
+
}
|
|
130
|
+
if (!liveTimer.isInitialized) {
|
|
131
|
+
throw new ActionLiveDataObjectInitializedError(
|
|
132
|
+
"liveTimer",
|
|
133
|
+
"pause"
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
return await liveTimer.pause();
|
|
137
|
+
}, [container, liveTimer]);
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Setup change listeners and start `LiveTimer` if needed
|
|
141
|
+
*/
|
|
142
|
+
React.useEffect(() => {
|
|
143
|
+
if (liveTimer === undefined) return;
|
|
144
|
+
// Reset default values, which is needed for when the `id` changes and a new DDS is loaded.
|
|
145
|
+
// React does not re-render if the values are already set to defaults (e.g., initial DDS).
|
|
146
|
+
setTimerConfig(undefined);
|
|
147
|
+
setMilliRemaining(undefined);
|
|
148
|
+
// Register event listeners
|
|
149
|
+
const onTimerConfigChange = (config: ITimerConfig) => {
|
|
150
|
+
setTimerConfig(config);
|
|
151
|
+
};
|
|
152
|
+
const onDidStart = (config: ITimerConfig) => {
|
|
153
|
+
onTimerConfigChange(config);
|
|
154
|
+
onStart?.(config);
|
|
155
|
+
setMilliRemaining(config.duration);
|
|
156
|
+
};
|
|
157
|
+
const onDidFinish = (config: ITimerConfig) => {
|
|
158
|
+
onTimerConfigChange(config);
|
|
159
|
+
onFinish?.(config);
|
|
160
|
+
setMilliRemaining(0);
|
|
161
|
+
};
|
|
162
|
+
const onDidPlay = (config: ITimerConfig) => {
|
|
163
|
+
onTimerConfigChange(config);
|
|
164
|
+
onPlay?.(config);
|
|
165
|
+
};
|
|
166
|
+
const onDidPause = (config: ITimerConfig) => {
|
|
167
|
+
onTimerConfigChange(config);
|
|
168
|
+
onPause?.(config);
|
|
169
|
+
};
|
|
170
|
+
const onDidTick = (milliseconds: number) => {
|
|
171
|
+
setMilliRemaining(milliseconds);
|
|
172
|
+
onTick?.(milliseconds);
|
|
173
|
+
};
|
|
174
|
+
liveTimer.on(LiveTimerEvents.started, onDidStart);
|
|
175
|
+
liveTimer.on(LiveTimerEvents.finished, onDidFinish);
|
|
176
|
+
liveTimer.on(LiveTimerEvents.played, onDidPlay);
|
|
177
|
+
liveTimer.on(LiveTimerEvents.paused, onDidPause);
|
|
178
|
+
liveTimer.on(LiveTimerEvents.onTick, onDidTick);
|
|
179
|
+
if (
|
|
180
|
+
liveTimer.initializeState === LiveDataObjectInitializeState.needed
|
|
181
|
+
) {
|
|
182
|
+
// Start live event
|
|
183
|
+
liveTimer.initialize(allowedRoles);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return () => {
|
|
187
|
+
// on unmount, remove event listeners
|
|
188
|
+
liveTimer?.off(LiveTimerEvents.started, onDidStart);
|
|
189
|
+
liveTimer?.off(LiveTimerEvents.finished, onDidFinish);
|
|
190
|
+
liveTimer?.off(LiveTimerEvents.played, onDidPlay);
|
|
191
|
+
liveTimer?.off(LiveTimerEvents.paused, onDidPause);
|
|
192
|
+
liveTimer?.off(LiveTimerEvents.onTick, onDidTick);
|
|
193
|
+
};
|
|
194
|
+
}, [liveTimer, onTick, onStart, onFinish, onPlay, onPause]);
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Change tick rate if changes in props
|
|
198
|
+
*/
|
|
199
|
+
React.useEffect(() => {
|
|
200
|
+
if (
|
|
201
|
+
tickRate !== undefined &&
|
|
202
|
+
liveTimer?.tickRate !== undefined &&
|
|
203
|
+
tickRate !== liveTimer?.tickRate
|
|
204
|
+
) {
|
|
205
|
+
liveTimer.tickRate = tickRate;
|
|
206
|
+
}
|
|
207
|
+
}, [tickRate, liveTimer?.tickRate]);
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
liveTimer,
|
|
211
|
+
milliRemaining,
|
|
212
|
+
pause,
|
|
213
|
+
play,
|
|
214
|
+
start,
|
|
215
|
+
timerConfig,
|
|
216
|
+
};
|
|
217
|
+
}
|