UNPKG

co-share

Version:

A Javascript framework for easily building shared applications such as chats and games

18 lines (17 loc) 946 B
import { Observable } from "rxjs"; import { PathEntry, Store, StoreMap } from "."; import { StoreLink, StoreLinkId } from "./store-link"; import { Subscriber, SubscriberGetParams } from "./subscriber"; export declare const SubscribeRequest: import("./request").UnboundRequest<RootStore, [id: StoreLinkId, path: PathEntry], any[]>; export declare class RootStore extends Store { readonly storeMap: StoreMap; subscriber: Subscriber<RootStore, []>; constructor(storeMap: StoreMap); private requestSubscribe; addStore(store: Store, path: PathEntry): void; destroyStore(store: Store, path: PathEntry): void; subscribe<S extends Store>(path: PathEntry, parentLink: StoreLink, storeFactory: StoreFactory<S>): Observable<[S, StoreLink]>; onUnlink(link: StoreLink): void; onLink(link: StoreLink): void; } export declare type StoreFactory<S extends Store> = (...remoteParams: SubscriberGetParams<S["subscriber"]>) => S;