UNPKG

986 BTypeScriptView Raw
1/**
2 * Change description used for change callbacks in GlobalSettings.
3 *
4 * @public
5 * {@docCategory IChangeDescription}
6 */
7export interface IChangeDescription {
8 key: string;
9 oldValue: any;
10 value: any;
11}
12/**
13 * Change event callback.
14 *
15 * @public
16 * {@docCategory IChangeEventCallback}
17 */
18export interface IChangeEventCallback {
19 __id__?: string;
20 (changeDescription?: IChangeDescription): void;
21}
22/**
23 * Global settings helper, which stores settings in the global (window) namespace.
24 * If window is not provided, it will store settings in module scope. Provides a
25 * way to observe changes as well when their values change.
26 *
27 * @public
28 * {@docCategory GlobalSettings}
29 */
30export declare class GlobalSettings {
31 static getValue<T>(key: string, defaultValue?: T | (() => T)): T;
32 static setValue<T>(key: string, value: T): T;
33 static addChangeListener(cb: IChangeEventCallback): void;
34 static removeChangeListener(cb: IChangeEventCallback): void;
35}
36
\No newline at end of file