MCPcopy Index your code
hub / github.com/tinyplex/tinybase / useSetCheckpointCallback

Function useSetCheckpointCallback

src/ui-solid/primitives.ts:1821–1842  ·  view source on GitHub ↗
(
  getCheckpoint: (parameter: Parameter) => string | undefined = getUndefined,
  checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,
  then: (
    checkpointId: MaybeAccessor<Id>,
    checkpoints: Checkpoints,
    label?: string,
  ) => void = getUndefined,
)

Source from the content-addressed store, hash-verified

1819 );
1820
1821export const useSetCheckpointCallback = <Parameter>(
1822 getCheckpoint: (parameter: Parameter) => string | undefined = getUndefined,
1823 checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,
1824 then: (
1825 checkpointId: MaybeAccessor<Id>,
1826 checkpoints: Checkpoints,
1827 label?: string,
1828 ) => void = getUndefined,
1829): ParameterizedCallback<Parameter> => {
1830 const checkpoints = useCheckpointsOrCheckpointsById(
1831 checkpointsOrCheckpointsId,
1832 );
1833 return (parameter) =>
1834 ifNotUndefined(getThing(checkpoints), (resolvedCheckpoints) => {
1835 const label = getCheckpoint(parameter as Parameter);
1836 then(
1837 resolvedCheckpoints.addCheckpoint(label),
1838 resolvedCheckpoints,
1839 label,
1840 );
1841 });
1842};
1843
1844export const useGoBackwardCallback = (
1845 checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,

Callers 2

WriterFunction · 0.90
primitives.test.tsFile · 0.90

Calls 4

getThingFunction · 0.70
addCheckpointMethod · 0.65
getCheckpointFunction · 0.50

Tested by 1

WriterFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…