Docs


Save and restore data

In 'logged in' runs, the run has certain powers. In particular, it can save data on the server in your account. The World can save a user's choices, their place in a game, or even things they have been creating, and restore them next time.

The data is saved in files like this in your uploads directory:

 /uploads/YOURID/_data.WORLDID.json  
The run can later read back from that file. (In fact, any run can read that file.)

 
 
AB.saveData ( object );             
    // Save this object to the server for this user for this World.

AB.queryDataExists ( function ( boolean ) { ... } );  
    // Query if data exists on the server for this user for this World.
    // When it returns, it calls the callback function with boolean (exists or not).

AB.restoreData ( function ( object ) { ... } );      
    // Recover the data saved for this user for this World.
    // When it returns, it calls the callback function with the object. 
					
AB.getAllData ( function ( array ) { ... } );    
    // Get all data saved for all users for this World.
    // When it returns, it calls the callback function with an array. 
    // This is an array of items ( userid, username, object ).