import { Assign, NonUndefined } from 'utility-types'; import { KeyValue } from '../types'; import { Basecoat } from '../common'; export declare class Store extends Basecoat> { protected data: D; protected previous: D; protected changed: Partial; protected pending: boolean; protected changing: boolean; protected pendingOptions: Store.MutateOptions | null; constructor(data?: Partial); protected mutate(data: Partial, options?: Store.MutateOptions): this; get(): D; get(key: K): D[K]; get(key: K, defaultValue: D[K]): NonUndefined; get(key: string): T; get(key: string, defaultValue: T): T; getPrevious(key: keyof D): T | undefined; set(key: K, value: D[K] | null | undefined | void, options?: Store.SetOptions): this; set(key: string, value: any, options?: Store.SetOptions): this; set(data: D, options?: Store.SetOptions): this; remove(key: K | K[], options?: Store.SetOptions): this; remove(options?: Store.SetOptions): this; getByPath(path: string | string[]): T; setByPath(path: string | string[], value: any, options?: Store.SetByPathOptions): this; removeByPath(path: string | string[], options?: Store.SetOptions): this; hasChanged(): boolean; hasChanged(key: K | null): boolean; hasChanged(key: string | null): boolean; /** * Returns an object containing all the data that have changed, * or `null` if there are no changes. Useful for determining what * parts of a view need to be updated. */ getChanges(diff?: Partial): Partial | null; /** * Returns a copy of the store's `data` object. */ toJSON(): D; clone(): T; dispose(): void; } export declare namespace Store { export interface SetOptions extends KeyValue { silent?: boolean; } export interface MutateOptions extends SetOptions { unset?: boolean; } export interface SetByPathOptions extends SetOptions { rewrite?: boolean; } type CommonArgs = { store: Store; }; export interface EventArgs { 'change:*': Assign<{ key: K; current: D[K]; previous: D[K]; options: MutateOptions; }, CommonArgs>; changed: Assign<{ current: D; previous: D; options: MutateOptions; }, CommonArgs>; disposed: CommonArgs; } export {}; }