@awayjs/core
Version:
AwayJS core classes
58 lines • 2.18 kB
TypeScript
import { EventBase } from '../events/EventBase';
import { EventDispatcher } from '../events/EventDispatcher';
export interface IConfigStore extends Record<string, number | boolean | string> {
}
export declare class StoreEvent extends EventBase {
readonly storeName: string;
readonly propName: string;
readonly newValue: any;
readonly oldValue: any;
readonly store: IConfigStore;
constructor(type: string, storeName: string, propName: string, newValue: any, oldValue: any, store: IConfigStore);
}
export declare class ConfigManager extends EventDispatcher {
static CHANGE_EVENT: string;
private static _instance;
static get instance(): ConfigManager;
private _proxies;
private _lib;
propertyChange(storeName: string, prop: string, oldValue: any, newValue: any, setter?: boolean): void;
private wrapObject;
/**
* Return referenced object of store.
* NOTE! Direct modification of it property will emit warning
* @param name
*/
getStoreRef<T extends IConfigStore>(name: string): T;
/**
* Similar `set` but register store from object and merge values if already exist, return observabled object
* @param name
* @param obj
*/
addStore<T extends IConfigStore>(name: string, obj: T): T;
/**
* Set specific value or series of values to store, emit changeEvent when value changes
* @param storeName
* @param objOrName
* @param valueOrNone
*/
set<T extends IConfigStore>(storeName: string, objOrName: Partial<T> | string, valueOrNone?: any): boolean;
/**
* Get stored value from specific store by
* @param storeName
* @param key
*/
get(storeName: string, key: string): any;
/**
* Serialize store to JSON
*/
serialize(): string;
/**
* Deserialize data to current active manager
* @param jsonObject
* @param quiet - no emit change event, only create stores
*/
deserialize(jsonObject: Record<string, IConfigStore> | string, quiet?: boolean): void;
static deserialize(jsonObject: Record<string, IConfigStore>, quiet?: boolean): void;
}
//# sourceMappingURL=ConfigManager.d.ts.map