Tldraw/packages/tlsync-client/api-report.md

3.3 KiB

API Report File for "@tldraw/tlsync-client"

Do not edit this file. It is a report generated by API Extractor.


import { RecordsDiff } from '@tldraw/tlstore';
import { SerializedSchema } from '@tldraw/tlstore';
import { Store } from '@tldraw/tlstore';
import { StoreSnapshot } from '@tldraw/tlstore';
import { SyncedStore } from '@tldraw/editor';
import { TldrawEditorConfig } from '@tldraw/editor';
import { TLInstanceId } from '@tldraw/editor';
import { TLRecord } from '@tldraw/editor';
import { TLStore } from '@tldraw/editor';
import { TLStoreSchema } from '@tldraw/editor';
import { TLUser } from '@tldraw/editor';
import { TLUserId } from '@tldraw/editor';

// @public (undocumented)
export function addDbName(name: string): void;

// @public (undocumented)
export class BroadcastChannelMock {
    constructor(_name: string);
    // (undocumented)
    close(): void;
    // (undocumented)
    onmessage?: (e: MessageEvent) => void;
    // (undocumented)
    postMessage(_msg: Message): void;
}

// @public (undocumented)
export function clearDb(universalPersistenceKey: string): void;

// @public (undocumented)
export const DEFAULT_DOCUMENT_NAME: any;

// @public (undocumented)
export function getAllIndexDbNames(): string[];

// @public (undocumented)
export function getUserData(): TLUser;

// @public (undocumented)
export function hardReset({ shouldReload }?: {
    shouldReload?: boolean | undefined;
}): Promise<void>;

// @public (undocumented)
export function loadDataFromStore(universalPersistenceKey: string, opts?: {
    didCancel?: () => boolean;
}): Promise<{
    records: TLRecord[];
    schema?: SerializedSchema;
} | undefined>;

// @public (undocumented)
export const STORE_PREFIX = "TLDRAW_DOCUMENT_v2";

// @public (undocumented)
export function storeChangesInIndexedDb(universalPersistenceKey: string, schema: TLStoreSchema, changes: RecordsDiff<any>, opts?: {
    didCancel?: () => boolean;
}): Promise<void>;

// @public (undocumented)
export function storeSnapshotInIndexedDb(universalPersistenceKey: string, schema: TLStoreSchema, snapshot: StoreSnapshot<any>, opts?: {
    didCancel?: () => boolean;
}): Promise<void>;

// @public (undocumented)
export function subscribeToUserData(store: Store<any>): () => void;

// @public (undocumented)
export const TAB_ID: TLInstanceId;

// @public (undocumented)
export class TLLocalSyncClient {
    constructor(store: TLStore, { universalPersistenceKey, onLoad, onLoadError, }: {
        universalPersistenceKey: string;
        onLoad: (self: TLLocalSyncClient) => void;
        onLoadError: (error: Error) => void;
    }, channel?: BroadcastChannel | BroadcastChannelMock);
    // (undocumented)
    readonly channel: BroadcastChannel | BroadcastChannelMock;
    // (undocumented)
    close(): void;
    // (undocumented)
    initTime: number;
    // (undocumented)
    readonly serializedSchema: SerializedSchema;
    // (undocumented)
    readonly store: TLStore;
    // (undocumented)
    readonly universalPersistenceKey: string;
}

// @public
export function useLocalSyncClient({ universalPersistenceKey, instanceId, userId, config, }: {
    universalPersistenceKey: string;
    instanceId: TLInstanceId;
    userId: TLUserId;
    config: TldrawEditorConfig;
}): SyncedStore;

// (No @packageDocumentation comment for this package)