The instanceAppData object currently includes (2) methods:
The instanceAppData.set method will return NO DATA. If an error occurs, it will call the custom error function.
The instanceAppData.get method will return one object (which is sent to the callback function). If an error occurred, the error function will be fired.
The returned object contains all of the requested data in the following format:
returnedObj:{
dataKey1:uniqueValue1 // Array OR String
,dataKey2:uniqueValue2 // Array OR String
,...
}
Note that the returned data will be an Array or a String depending on what type was sent into the instanceAppData.set method. Here is an example of using this object to get and print some data:
// getting back data
instanceAppData.get( // single method call... (3) arguments
['myData', 'myData2']
,handleData
,function(e){ alert(e); }
);
function handleData(ret){ // the data handler function
// look for myData (Assumed to be a String)
alert( 'myData: '+ret['myData'] );
// look for myData2 (Assumed to be an Array)
var myData2 = ret['myData2'];
for( var i = 0; i < myData2.length; i++ ){
alert( myData2[i] );
}
}
This object is the result of our Instance App Data Tutorial, which explains in detail the steps taken to create this object. This file should be considered public domain.
To view the object code, please use this link: http://www.iwiddit.com/article_xml/instanceAppData.html
A working xml example can be found here: http://www.iwiddit.com/article_xml/instanceAppData.xml