(
getCheckpoint: (parameter: Parameter) => string | undefined = getUndefined,
getCheckpointDeps: DependencyList = EMPTY_ARRAY,
checkpointsOrCheckpointsId?: CheckpointsOrCheckpointsId,
then: (
checkpointId: Id,
checkpoints: Checkpoints,
label?: string,
) => void = getUndefined,
thenDeps: DependencyList = EMPTY_ARRAY,
)
| 2195 | ); |
| 2196 | |
| 2197 | export const useSetCheckpointCallback: typeof useSetCheckpointCallbackDecl = < |
| 2198 | Parameter, |
| 2199 | >( |
| 2200 | getCheckpoint: (parameter: Parameter) => string | undefined = getUndefined, |
| 2201 | getCheckpointDeps: DependencyList = EMPTY_ARRAY, |
| 2202 | checkpointsOrCheckpointsId?: CheckpointsOrCheckpointsId, |
| 2203 | then: ( |
| 2204 | checkpointId: Id, |
| 2205 | checkpoints: Checkpoints, |
| 2206 | label?: string, |
| 2207 | ) => void = getUndefined, |
| 2208 | thenDeps: DependencyList = EMPTY_ARRAY, |
| 2209 | ): ParameterizedCallback<Parameter> => { |
| 2210 | const checkpoints = useCheckpointsOrCheckpointsById( |
| 2211 | checkpointsOrCheckpointsId, |
| 2212 | ); |
| 2213 | return useCallback( |
| 2214 | (parameter) => |
| 2215 | ifNotUndefined(checkpoints, (checkpoints) => { |
| 2216 | const label = getCheckpoint(parameter as any); |
| 2217 | then(checkpoints.addCheckpoint(label), checkpoints, label); |
| 2218 | }), |
| 2219 | // eslint-disable-next-line react-hooks/exhaustive-deps |
| 2220 | [checkpoints, ...getCheckpointDeps, ...thenDeps], |
| 2221 | ); |
| 2222 | }; |
| 2223 | |
| 2224 | export const useGoBackwardCallback: typeof useGoBackwardCallbackDecl = ( |
| 2225 | checkpointsOrCheckpointsId?: CheckpointsOrCheckpointsId, |
searching dependent graphs…