1 | import { Store } from "./store.js";
|
2 | import { Connection } from "./connection.js";
|
3 | import { UnsubscribeFunc } from "./types.js";
|
4 | export declare type Collection<State> = {
|
5 | state: State;
|
6 | refresh(): Promise<void>;
|
7 | subscribe(subscriber: (state: State) => void): UnsubscribeFunc;
|
8 | };
|
9 | export declare const getCollection: <State>(conn: Connection, key: string, fetchCollection: (conn: Connection) => Promise<State>, subscribeUpdates?: ((conn: Connection, store: Store<State>) => Promise<UnsubscribeFunc>) | undefined) => Collection<State>;
|
10 | export declare const createCollection: <State>(key: string, fetchCollection: (conn: Connection) => Promise<State>, subscribeUpdates: ((conn: Connection, store: Store<State>) => Promise<UnsubscribeFunc>) | undefined, conn: Connection, onChange: (state: State) => void) => UnsubscribeFunc;
|