co-share
Version:
A Javascript framework for easily building shared applications such as chats and games
24 lines (23 loc) • 1.02 kB
TypeScript
import { Connection, StoreLink, StoreLinkId } from ".";
import { ActionIdentifier, Action } from "./action";
import { Subscriber } from "./subscriber";
export declare type PathEntry = string | number;
export declare const LogAction: import("./action").UnboundAction<Store, [log: any]>;
export declare const UnsubscribeAction: import("./action").UnboundAction<Store, []>;
export declare abstract class Store {
get mainLink(): StoreLink;
readonly actionMap: Map<ActionIdentifier, Action<Store, any[]>>;
abstract readonly subscriber: Subscriber<Store, Array<any>>;
log: Action<Store, [log: any]>;
unsubscribe: Action<Store, []>;
readonly linkSet: Set<StoreLink>;
/**
* executed right after the link was deleted from the store's linkSet
*/
abstract onUnlink(link: StoreLink): void;
/**
* executed right after the link was inserted into the store's linkSet
*/
abstract onLink(link: StoreLink): void;
link(id: StoreLinkId, connection: Connection): StoreLink;
}