What is the best way to save multiple presets (basically the states of all the elements of a plugin - checkboxes, radio.buttons, sliders, textfields, … ) between sessions and even between plugin updates?
In the end I want to have a dropdown menu where I can pick different entries and all the UI elements are set accordingly.
first store your presets in an object
stringify the object and store the JSON file to local disk (plugin folder) if security is not a concern.
another option is to store the JSON string in local storage .
you will need two functions:
the saver function
to loop through element and store their settings inside an object then stringify it and store it.
the loader function
to parse the JSON and loop through properties and set settings of element accordingly
Provides a local key-value store useful for setting preferences and other kinds of data. This data is technically persistent, but can be cleared in a variety of ways, so you should not store data using localStorage that you cannot otherwise reconstruct.