To make the app above, we first took a data snapshot of our lifeforms dataset, modified it slightly in a text editor (spot the odd one out), and loaded the snapshot into the app.

A data snapshot is used during application testing. With data snapshots, you can record the datasets loaded by a page to a file, and then restore those datasets from the file later on. Data Snapshots are ideal if you want to create a static version of the app e.g. to send to a designer to look at.

To use data snapshots, first make your snap file, then add a <j:snapshot> element to your App to load the snap file.

Creating a snap file

To create a snap file, first open the Inspector and click on the Snapshot button, which is on the row of buttons above the console.

When you click on Snapshot, the Inspector creates a JSON text description of all the datasets currently loaded into the app you are inspecting. The JSON snapshot is output as text within the Inspector's console area.

Next, select and copy the snapshot text onto the clipboard, open a text editor, e.g. Notepad, paste the text and then save it to a file in your project.

By convention, snapshot files have the file extension .snap, e.g. this Quick Tour example is using test1.snap.

Restoring a snap file

To restore a page from a snap file, add a <j:snapshot> directive within an <j:App> on a page:

    <j:App>
        <j:snapshot src="snapshot1.snap"/>
        ... rest of app here...
    </j:App>

When the page is compiled with Diagnostics turned on, the snapshot directive causes the data in the file "snapshot1.snap" to be loaded into the page at startup time..