Touch Develop retirement postponed until June 22, 2019. Sign-in and access to cloud assets to be removed on May 23, 2018.Learn More..

persistent data

data variables, similarly to tables and indexes, can be saved between script runs. This is done by checking the local or replicated radio-button. You will note that this is only supported for certain types:
The collection types are not supported. If you want to store a collection of values you have two options:
  • use a table or index - the data will be saved/synchronized on every write to the table
  • use a temporary Collection, Number Map, etc., and save your data explicitly - declare a local or cloud global variable of type Json Object and serialize your collection using →to json property
The temporary collection solution is about an order of magnitude faster, but for vast majority of uses the table/index solution is fast enough - even on a very slow device you will get about 5000 writes per second.


Saving variables is useful when you want to store some configuration - like user name, phone number or last visited location in your script. When you choose the local option, we save the data on the device, where it remains even after you power off your phone or close your browser window. When you choose the replicated option, the data is saved not just on one device, but also backed up in the cloud and synchronized between devices. It is stored in a so-called cloud session).

when is the data deleted?

When you choose the local option, the data is deleted if the user logs out, or pushes the delete local data and permissions button in the script properties page. It is also deleted when you uninstall the script. When you choose the replicated option, the data is stored in the current cloud session). You can manage your cloud sessions by pushing the cloud sessions button in the script properties page.


In the past, TouchDevelop, particularly the Windows Phone 7 app, would save all variables between script runs. We have changed this in May 2013 to improve start-up performance.
It was also necessary to account for the possibility of the user closing the browser window with no notice and the TouchDevelop scripts that never stop.