mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 19:10:39 +00:00
39 lines
749 B
TypeScript
39 lines
749 B
TypeScript
export type SyncProgressState = {
|
|
completed: number;
|
|
total: number;
|
|
label?: string;
|
|
report: (update: { completed: number; total: number; label?: string }) => void;
|
|
};
|
|
|
|
export function bumpSyncProgressTotal(
|
|
progress: SyncProgressState | undefined,
|
|
delta: number,
|
|
label?: string,
|
|
) {
|
|
if (!progress) {
|
|
return;
|
|
}
|
|
progress.total += delta;
|
|
progress.report({
|
|
completed: progress.completed,
|
|
total: progress.total,
|
|
label,
|
|
});
|
|
}
|
|
|
|
export function bumpSyncProgressCompleted(
|
|
progress: SyncProgressState | undefined,
|
|
delta = 1,
|
|
label?: string,
|
|
) {
|
|
if (!progress) {
|
|
return;
|
|
}
|
|
progress.completed += delta;
|
|
progress.report({
|
|
completed: progress.completed,
|
|
total: progress.total,
|
|
label,
|
|
});
|
|
}
|