Class Settings
Source: settings.ts
Constructors
Constructor
new Settings(
virtualRoot:VirtualRoot,path:string):Settings
Parameters
virtualRoot
path
string
Returns
Settings
Properties
path
path:
string
The virtual path of the settings file.
file
file:
VirtualFile
The settings file.
xmlDoc?
optionalxmlDoc:Document
DESKTOP
readonlystaticDESKTOP:string=SettingsManager.VIRTUAL_PATHS.desktop
Virtual path to the desktop settings.
TASKBAR
readonlystaticTASKBAR:string=SettingsManager.VIRTUAL_PATHS.taskbar
Virtual path to the taskbar settings.
APPS
readonlystaticAPPS:string=SettingsManager.VIRTUAL_PATHS.apps
Virtual path to the apps settings.
THEME
readonlystaticTHEME:string=SettingsManager.VIRTUAL_PATHS.theme
Virtual path to the theme settings.
VIRTUAL_DRIVE
readonlystaticVIRTUAL_DRIVE:string=SettingsManager.VIRTUAL_PATHS.virtualDrive
Virtual path to the virtual drive settings.
Methods
read()
read():
Promise<void>
Reads the xml doc from the given path and assigns it to itself.
Returns
Promise<void>
write()
write():
void
Returns
void
isMissingXmlDoc()
isMissingXmlDoc():
Promise<boolean>
Checks if xml doc is missing.
Returns
Promise<boolean>
get()
get(
key:string,callback?: (value:string) =>void):Promise<{value:string|null;listener?:SettingsListener; }>
Gets a value by a given key if it exists and optionally calls a callback function whenever the value changes.
Parameters
key
string
The key of the setting.
callback?
(value: string) => void
The callback function to call whenever the value changes.
Returns
Promise<{ value: string | null; listener?: SettingsListener; }>
getBool()
getBool(
key:string,callback?: (value:boolean) =>void):Promise<{value:boolean|null;listener?:SettingsListener; }>
Gets a value by a given key as a boolean.
Parameters
key
string
callback?
(value: boolean) => void
Returns
Promise<{ value: boolean | null; listener?: SettingsListener; }>
getInt()
getInt(
key:string,callback?: (value:number) =>void):Promise<{value:number|null;listener?:SettingsListener; }>
Gets a value by a given key as an integer.
Parameters
key
string
callback?
(value: number) => void
Returns
Promise<{ value: number | null; listener?: SettingsListener; }>
set()
set(
key:string,value:string):Promise<void>
Sets the value associated with a given key.
Parameters
key
string
The key of the setting.
value
string
The new value.
Returns
Promise<void>
removeListener()
removeListener(
listener:SettingsListener):void
Removes a listener from the settings file.
Parameters
listener
The listener to remove.
Returns
void