Configs
Last updated
Last updated
Path to file where the config will be stored. By default - ./config.json
A function that will encode an object to a string. By default - JSON.stringify
A function that will decode an object from a string. By default - JSON.parse
Empathize has two models of working with your config files. The first and default is when all the changes save directly to the config file, so on your disk, and the second is when all the changes are saved in your application memory before you'd call Configs.flush()
method to save them to your config file
This model will prevent your application from various bugs caused by several windows usage, but it also will mean that every Configs.set()
call it will write some data to your disk, which is not really good, and Configs.get()
will fetch configs from the disk which also means additional delay
With autoFlush = false
all the config changes will be stored in your application's memory. To save these changes to the disk you'll need to call Configs.flush()
method. This model will highly increase overall performance, but also requires you to develop your application carefully, so different windows will flush their config changes properly
Saves config from the application's memory to the disk
Loads config from the disk to the application's memory. Uses to load configs changes from another window, because all the windows have separate memories, and changes in one window will be unavailable in another