UNPKG

1.67 kBTypeScriptView Raw
1export declare type ISettings = {
2 [key: string]: any;
3};
4export declare type ISettingsFunction = (settings: ISettings) => ISettings;
5/**
6 * @deprecated Use ISettings.
7 */
8export declare type Settings = ISettings;
9/**
10 * @deprecated Use ISettingsFunction.
11 */
12export declare type SettingsFunction = ISettingsFunction;
13export interface ICustomizations {
14 settings: ISettings;
15 scopedSettings: {
16 [key: string]: ISettings;
17 };
18 inCustomizerContext?: boolean;
19}
20export declare class Customizations {
21 private static _suppressUpdates;
22 static reset(): void;
23 /** Apply global Customization settings.
24 * @example Customizations.applySettings(\{ theme: \{...\} \});
25 */
26 static applySettings(settings: ISettings): void;
27 /** Apply Customizations to a particular named scope, like a component.
28 * @example Customizations.applyScopedSettings('Nav', \{ styles: () =\> \{\} \});
29 */
30 static applyScopedSettings(scopeName: string, settings: ISettings): void;
31 static getSettings(properties: string[], scopeName?: string, localSettings?: ICustomizations): any;
32 /** Used to run some code that sets Customizations without triggering an update until the end.
33 * Useful for applying Customizations that don't affect anything currently rendered, or for
34 * applying many customizations at once.
35 * @param suppressUpdate - Do not raise the change event at the end, preventing all updates
36 */
37 static applyBatchedUpdates(code: () => void, suppressUpdate?: boolean): void;
38 static observe(onChange: () => void): void;
39 static unobserve(onChange: () => void): void;
40 private static _raiseChange;
41}