Expose cursor management

This commit is contained in:
Andras Schmelczer 2025-06-07 22:14:30 +01:00
parent 02f32e894a
commit 7e3f972531
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
3 changed files with 34 additions and 6 deletions

View file

@ -19,6 +19,8 @@ import type { NetworkConnectionStatus } from "./types/network-connection-status"
import { DocumentUpdateStatus } from "./types/document-update-status";
import { WebSocketManager } from "./services/websocket-manager";
import { createClientId } from "./utils/create-client-id";
import { CursorSpan } from "./services/types/CursorSpan";
import { ClientCursors } from "./services/types/ClientCursors";
export class SyncClient {
private static readonly MINIMUM_SAVE_INTERVAL_MS = 1000;
@ -273,6 +275,18 @@ export class SyncClient {
});
}
public async updateLocalCursors(documentToCursors: {
[path: RelativePath]: CursorSpan[];
}): Promise<void> {
return this.webSocketManager.updateLocalCursors({ documentToCursors });
}
public addRemoteCursorsUpdateListener(
listener: (cursors: ClientCursors[]) => void
): void {
this.webSocketManager.addRemoteCursorsUpdateListener(listener);
}
public getDocumentSyncingStatus(
relativePath: RelativePath
): DocumentUpdateStatus {