Space sync now scheduled
This commit is contained in:
parent
7cce83b240
commit
bd77f2932c
@ -133,10 +133,6 @@ export function vimEx(exCommand: string): Promise<any> {
|
||||
return syscall("editor.vimEx", exCommand);
|
||||
}
|
||||
|
||||
export function syncSpace(): Promise<number> {
|
||||
return syscall("editor.syncSpace");
|
||||
}
|
||||
|
||||
// Folding
|
||||
|
||||
export function fold() {
|
||||
|
@ -11,3 +11,7 @@ export function hasInitialSyncCompleted(): Promise<boolean> {
|
||||
export function scheduleFileSync(path: string): Promise<void> {
|
||||
return syscall("sync.scheduleFileSync", path);
|
||||
}
|
||||
|
||||
export function scheduleSpaceSync(): Promise<number> {
|
||||
return syscall("sync.scheduleSpaceSync");
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { editor } from "$sb/silverbullet-syscall/mod.ts";
|
||||
import { editor, sync } from "$sb/silverbullet-syscall/mod.ts";
|
||||
|
||||
export async function syncSpaceCommand() {
|
||||
await editor.flashNotification("Syncing space...");
|
||||
await editor.syncSpace();
|
||||
await sync.scheduleSpaceSync();
|
||||
await editor.flashNotification("Done.");
|
||||
}
|
||||
|
@ -166,6 +166,11 @@ export class SyncService {
|
||||
this.filesScheduledForSync.delete(path);
|
||||
}
|
||||
|
||||
async scheduleSpaceSync(): Promise<void> {
|
||||
await this.noOngoingSync(5000);
|
||||
await this.syncSpace();
|
||||
}
|
||||
|
||||
start() {
|
||||
this.syncSpace().catch(console.error);
|
||||
|
||||
|
@ -184,10 +184,6 @@ export function editorSyscalls(editor: Client): SysCallMapping {
|
||||
const cm = vimGetCm(editor.editorView)!;
|
||||
return Vim.handleEx(cm, exCommand);
|
||||
},
|
||||
// Sync
|
||||
"editor.syncSpace": () => {
|
||||
return editor.syncService.syncSpace();
|
||||
},
|
||||
// Folding
|
||||
"editor.fold": () => {
|
||||
foldCode(editor.editorView);
|
||||
|
@ -12,5 +12,8 @@ export function syncSyscalls(editor: Client): SysCallMapping {
|
||||
"sync.scheduleFileSync": (_ctx, path: string): Promise<void> => {
|
||||
return editor.syncService.scheduleFileSync(path);
|
||||
},
|
||||
"sync.scheduleSpaceSync": () => {
|
||||
return editor.syncService.scheduleSpaceSync();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user