histoire
Version:
A fast story book powered by Vite
95 lines • 3.49 kB
TypeScript
/**
* Creates a `WebSocket` class for story collection that never connects.
*
* App plugins (realtime sync, dev tools, ...) open sockets while the app boots.
* jsdom rejects relative or `http:` URLs and would otherwise try to reach a
* server that doesn't exist during collection. Sockets created here stay in
* `CONNECTING` until closed, so nothing is sent and no reconnect loop starts.
* @param baseUrl Document URL that relative socket URLs resolve against.
*/
export declare function createCollectWebSocket(baseUrl: string): {
new (url: string | URL, _protocols?: string | string[]): {
readonly CONNECTING: 0;
readonly OPEN: 1;
readonly CLOSING: 2;
readonly CLOSED: 3;
/** Absolute `ws:`/`wss:` URL, like the browser exposes it. */
readonly url: string;
readonly protocol: "";
readonly extensions: "";
readonly bufferedAmount: 0;
binaryType: BinaryType;
readyState: number;
onopen: ((event: Event) => void) | null;
onmessage: ((event: Event) => void) | null;
onerror: ((event: Event) => void) | null;
onclose: ((event: Event) => void) | null;
/** Data is dropped: there is no server during collection. */
send(_data: unknown): void;
/** Closes the socket synchronously and notifies `close` listeners once. */
close(_code?: number, _reason?: string): void;
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
dispatchEvent(event: Event): boolean;
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
};
readonly CONNECTING: 0;
readonly OPEN: 1;
readonly CLOSING: 2;
readonly CLOSED: 3;
};
/**
* IndexedDB globals backed by a fresh in-memory database, so app plugins that
* open IndexedDB at setup (offline stores, caches) work during collection.
*/
export declare function createCollectIndexedDb(): {
indexedDB: IDBFactory;
IDBCursor: {
new (): IDBCursor;
prototype: IDBCursor;
};
IDBCursorWithValue: {
new (): IDBCursorWithValue;
prototype: IDBCursorWithValue;
};
IDBDatabase: {
new (): IDBDatabase;
prototype: IDBDatabase;
};
IDBFactory: {
new (): IDBFactory;
prototype: IDBFactory;
};
IDBIndex: {
new (): IDBIndex;
prototype: IDBIndex;
};
IDBKeyRange: {
new (): IDBKeyRange;
prototype: IDBKeyRange;
bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;
lowerBound(lower: any, open?: boolean): IDBKeyRange;
only(value: any): IDBKeyRange;
upperBound(upper: any, open?: boolean): IDBKeyRange;
};
IDBObjectStore: {
new (): IDBObjectStore;
prototype: IDBObjectStore;
};
IDBOpenDBRequest: {
new (): IDBOpenDBRequest;
prototype: IDBOpenDBRequest;
};
IDBRequest: {
new (): IDBRequest;
prototype: IDBRequest;
};
IDBTransaction: {
new (): IDBTransaction;
prototype: IDBTransaction;
};
IDBVersionChangeEvent: {
new (type: string, eventInitDict?: IDBVersionChangeEventInit): IDBVersionChangeEvent;
prototype: IDBVersionChangeEvent;
};
};
//# sourceMappingURL=collect-globals.d.ts.map