Storage
App storage is where you keep the app data inside Spaces.
How to Store Data in App Storage
Recommended
App.setStorage(string);
The App.setStorage function is a data storage function complementing existing app data storage methods.
Not recommended
App.storage = string; App.save();
If the app is running on several maps in the same Space, the above method may cause issues such as data being overwritten.
How to Read the App Storage Value
App.getStorage(function(){})
The App.getStorage function helps synchronize the app data so that it can have the same data by checking if the same app is running on another map within the same Space.
As the App.getStorage function is an asynchronous function, synchronization cannot be guaranteed if you add a code that uses App.storage on the very next line of this function.
App Storage Example
Install the example code below as a sidebar app and press Q on another map in the same Space to see if the "count" value is synchronized.
Last updated