@launchmenu/core
Version:
An environment for visual keyboard controlled applets
100 lines • 4.53 kB
TypeScript
import { DataCacher, Field, IDataHook } from "model-react";
import { SettingsContext } from "../../settings/SettingsContext";
import { SettingsFile } from "../../settings/storage/fileTypes/SettingsFile";
import { ISettingsFolderMenuItem } from "../../settings/_types/ISettingsFolderMenuItem";
import { IUUID } from "../../_types/IUUID";
import { IApplet } from "../applets/_types/IApplet";
import { ISettingsData } from "./_types/ISettingsData";
import { ISettingsTree } from "../../settings/_types/ISettingsTree";
import { LaunchMenu } from "../LaunchMenu";
/**
* Manages the settings within LaunchMenu
*/
export declare class SettingsManager {
protected settingsDirectory: string;
protected dataDirectory: string;
protected LM: LaunchMenu;
protected extraFiles: Field<ISettingsData<ISettingsFolderMenuItem<import("../../settings/_types/IRenderableSettingsTree").IRenderableSettingsTree>, import("../../_types/IJSON").IJSON>[]>;
protected destroyed: Field<boolean>;
protected appletSettings: Field<ISettingsData<ISettingsFolderMenuItem<import("../../settings/_types/IRenderableSettingsTree").IRenderableSettingsTree>, import("../../_types/IJSON").IJSON>[]>;
/**
* Creates a new settings manager, which auto loads the settings of the passed applets
* @param LM The LaunchMenu instance to pass to settings
* @param settingsDirectory The directory to load the settings for the applets from
* @param dataDirectory The directory that LM data is stored in
*/
constructor(LM: LaunchMenu, settingsDirectory: string, dataDirectory?: string);
/**
* Disposes of all data
*/
destroy(): void;
/**
* Retrieves the settings data with a given ID
* @param ID The ID of the data to retrieve
* @param hook A hook to subscribe to changes
* @returns The settings data
*/
getSettingsData(ID: IUUID, hook?: IDataHook): ISettingsData | null;
/**
* Retrieves the settings data in the manager
* @param hook A hook to subscribe to changes
* @returns The settings data
*/
getAllSettingsData(hook?: IDataHook): ISettingsData[];
/**
* Retrieves the settings data in the manager for all files that have unsaved changes
* @param hook A hook to subscribe to changes
* @returns The settings data that hasn't been saved
*/
getAllDirtySettingsData(hook?: IDataHook): ISettingsData[];
/**
* Retrieves the settings files that are dirty
*/
protected dirtySettingsData: DataCacher<ISettingsData<ISettingsFolderMenuItem<import("../../settings/_types/IRenderableSettingsTree").IRenderableSettingsTree>, import("../../_types/IJSON").IJSON>[]>;
/**
* Retrieves a settings context that contains all settings in this manager
* @param hook A hook to subscribe to changes
* @returns The context that includes all settings
*/
getSettingsContext(hook?: IDataHook): SettingsContext;
/**
* Adds the specified settings to the manager
* @param ID The identifier for the settings
* @param settings The settings to be added
* @param applet An applet that the settings are connected to
*/
addSettings(ID: IUUID, settings: SettingsFile<any>, applet?: IApplet): void;
/**
* Updates the specified settings, removing the old version
* @param ID The identifier for the settings
* @param settings The settings to be updated
* @param applet An applet that the settings are connected to
*/
updateSettings(ID: IUUID, settings: SettingsFile<any>, applet?: IApplet): void;
/**
* Removes the settings with the specified id
* @param ID The ID of the settings to remove
*/
removeSettings(ID: IUUID): void;
/**
* Reloads all the settings
*/
reloadAll(): Promise<void>;
/**
* Saves all settings in the session
*/
saveAll(): Promise<void>;
/**
* Updates the settings for a given applet, used by the applet manager
* @param appletData The applet data to update
* @param version The new version of the applet
* @returns The tree of settings for this applet
*/
updateAppletSettings(applet: IApplet, version?: IUUID): ISettingsTree;
/**
* Removes the settings of an applet
* @param appletID The ID of the applet to remove
*/
destroyAppletSetting(appletID: IUUID): void;
}
//# sourceMappingURL=SettingsManager.d.ts.map