Class Settings
Source: settings.ts
Constructors
Constructor
new Settings(
virtualRoot:VirtualRoot,path:string):Settings
Parameters
virtualRoot
path
string
Returns
Settings
Methods
get()
get(
key:string,callback?: (value:string) =>void):Promise<{listener?:Listener;value:string|null; }>
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<{ listener?: Listener; value: string | null; }>
getBool()
getBool(
key:string,callback?: (value:boolean) =>void):Promise<{listener?:Listener;value:boolean|null; }>
Gets a value by a given key as a boolean
Parameters
key
string
callback?
(value: boolean) => void
Returns
Promise<{ listener?: Listener; value: boolean | null; }>
getInt()
getInt(
key:string,callback?: (value:number) =>void):Promise<{listener?:Listener;value:number|null; }>
Gets a value by a given key as an integer
Parameters
key
string
callback?
(value: number) => void
Returns
Promise<{ listener?: Listener; value: number | null; }>
isMissingXmlDoc()
isMissingXmlDoc():
Promise<boolean>
Checks if xml doc is missing
Returns
Promise<boolean>
read()
read():
Promise<void>
Reads the xml doc from the given path and assigns it to itself
Returns
Promise<void>
removeListener()
removeListener(
listener:Listener):void
Removes a listener from the settings file
Parameters
listener
The listener to remove
Returns
void
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>
write()
write():
void
Returns
void
Properties
file
file:
VirtualFile
path
path:
string
xmlDoc?
optionalxmlDoc:Document