API reference / @jsprismarine/script-host / host/addonConfig
host/addonConfig
Interfaces
AddonConfigStore
Defined in: script-host/src/host/addonConfig.ts:10
A pack's config file, as the server keeps it.
Methods
read()
read(
pack):unknown
Defined in: script-host/src/host/addonConfig.ts:15
The parsed JSON of the pack's config file, or undefined when there is no file. A file that fails to parse gives the value the last good read gave, and the server logs the failure once.
Parameters
pack
Returns
unknown
watch()
watch(
pack,changed): () =>void
Defined in: script-host/src/host/addonConfig.ts:23
Watches the pack's config file. changed may run on any turn of the event loop, and the runtime reads the file and raises the pack's event on its next flush.
Parameters
pack
changed
() => void
Returns
Stops the watch.
() => void
write()
write(
pack,value):void
Defined in: script-host/src/host/addonConfig.ts:17
Rewrites the pack's config file with a value, as JSON.
Parameters
pack
value
unknown
Returns
void