@casual-simulation/aux-common
Version:
Common library for AUX projects
52 lines • 2.38 kB
TypeScript
import type { SharedDocument } from './SharedDocument';
import type { ClientEvent, InstRecordsClient, MaxInstSizeReachedClientError, RateLimitExceededMessage } from '../websockets';
import type { SharedDocumentConfig } from './SharedDocumentConfig';
import type { PartitionAuthSource } from '../partitions/PartitionAuthSource';
import { YjsSharedDocument } from './YjsSharedDocument';
import type { SharedDocumentServices } from './SharedDocumentFactories';
export declare function createRemoteClientYjsSharedDocument(config: SharedDocumentConfig, services: SharedDocumentServices, client: InstRecordsClient): RemoteYjsSharedDocument;
/**
* Defines a shared document that is able to use YJS and a InstRecordsClient to synchronize over the network.
*/
export declare class RemoteYjsSharedDocument extends YjsSharedDocument implements SharedDocument {
protected _static: boolean;
protected _skipInitialLoad: boolean;
protected _sendInitialUpdates: boolean;
protected _watchingBranch: any;
protected _synced: boolean;
protected _authorized: boolean;
protected _temporary: boolean;
protected _readOnly: boolean;
protected _authSource: PartitionAuthSource;
unsubscribe(): void;
constructor(client: InstRecordsClient, authSource: PartitionAuthSource, config: SharedDocumentConfig);
connect(): void;
enableCollaboration(): Promise<void>;
private _initializePartitionWithoutLoading;
private _requestBranch;
private _watchBranch;
/**
* Handles a client error that was received from the server.
* @param event The event.
*/
private _handleClientError;
private _isNotAuthorizedErrorCode;
private _handleNotAuthorized;
/**
* Handles a client event that was received from the server.
* @param event The event that was received.
*/
protected _handleClientEvent(event: ClientEvent): void;
/**
* Called when the server sends a rate limit exceeded message.
* @param event The event that was sent.
*/
protected _onRateLimitExceeded(event: RateLimitExceededMessage): void;
/**
* Called when the server sends a max size reached message.
* @param event The event that was sent.
*/
protected _onMaxSizeReached(event: MaxInstSizeReachedClientError): void;
private _updateSynced;
}
//# sourceMappingURL=RemoteYjsSharedDocument.d.ts.map