silverbullet/web/syscalls/sync.ts

20 lines
651 B
TypeScript
Raw Normal View History

2024-07-30 23:33:33 +08:00
import type { SysCallMapping } from "../../lib/plugos/system.ts";
2023-07-14 22:56:20 +08:00
import type { Client } from "../client.ts";
2023-07-14 22:56:20 +08:00
export function syncSyscalls(editor: Client): SysCallMapping {
return {
"sync.isSyncing": (): Promise<boolean> => {
2023-07-14 19:44:30 +08:00
return editor.syncService.isSyncing();
},
"sync.hasInitialSyncCompleted": (): Promise<boolean> => {
2023-07-14 19:44:30 +08:00
return editor.syncService.hasInitialSyncCompleted();
},
"sync.scheduleFileSync": (_ctx, path: string): Promise<void> => {
return editor.syncService.scheduleFileSync(path);
},
2023-08-16 02:24:02 +08:00
"sync.scheduleSpaceSync": () => {
return editor.syncService.scheduleSpaceSync();
},
};
}