3.6Settings and state storage

Scripts and UDIXes can use indexedDB to store and retrieve data. Widgets are sandboxed, for security reasons, and are not allowed to use indexedDB or localStorage. You can, of course, also store data on external servers, sending and receiving it using something like XMLHttpRequest.

The framework also has its own storage mechanisms which a widget, script, or UDIX can use to store settings - saving and receiving back any JSON data. There are two important things to note about these framework features:

They are designed for storing small amounts of settings information, such as a user's most recent selection of market and timeframe etc. You should not use them to store large amounts of data (e.g. candles). The framework may ignore requests where the stringified size of your data exceeds 4KB.

You should not make rapid repeated calls to the storage functions. The framework has its own internal throttles, but instead of making lots of save-calls in quick succession you should implement a delay/queue yourself, and/or redesign your UI so that changes to settings are more monolithic and occasional.