UNPKG

co-share

Version:

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

13 lines (12 loc) 736 B
import { Connection } from "./connection"; import { Store } from "./store"; export declare const Subscriber: { create<S extends Store, Params extends any[]>(storeClass: new (...params: Array<any>) => S, subscriber: SubscriberFn<Params>): Subscriber<S, Params>; }; export declare type SubscriberFn<Params extends Array<any>> = (connection: Connection, accept: (...params: Params) => void, deny: (reason: string) => void) => void; export declare type SubscriberGetParams<S extends Subscriber<Store, Array<any>>> = S extends Subscriber<Store, infer T> ? T : never; export declare type Subscriber<S extends Store, Params extends Array<any>> = SubscriberFn<Params> & { storeClass: { new (...params: Array<any>): S; }; };