UNPKG

@dapplets/dapplet-extension

Version:
31 lines (30 loc) 941 B
import { BehaviorSubjectProxy } from 'rxjs-proxify'; import { Connection } from './connection'; import { ISharedState } from './types'; export type State<T> = GeneralState<T> & { [key: string]: BehaviorSubjectProxy<T>; }; interface IState { new <T = {}>(defaultState: T, type?: string): State<T>; } declare class GeneralState<T> implements ISharedState<T> { readonly defaultState: T; readonly type?: string; state: { [contextId: string | symbol]: BehaviorSubjectProxy<T>; }; global: BehaviorSubjectProxy<T>; private _connection; constructor(defaultState: T, type?: string); addConnection(conn: Connection<T>): void; get(id: string): BehaviorSubjectProxy<T>; set(data: Partial<T>, id?: string | symbol): void; getAll(): { [x: string]: T; [x: number]: T; [x: symbol]: T; }; private _resolveServerData; } export declare const State: IState; export {};