The personAppData object currently includes (2) methods:
The personAppData.set method will return NO DATA. If an error occurs, it will use it's internal log function (which you should adjust) to print out an error and exit.
The personAppData.get method will return one Map object (which is sent to the callback function as an argument).
The returned object contains all of the requested data in the following format:
{
PersonId1:{
dataKey1:uniqueValue1
,dataKey2:uniqueValue2
,dataKey3:uniqueValue3
,...
}
,PersonId2:{
dataKey1:uniqueValue1
,dataKey2:uniqueValue2
,dataKey3:uniqueValue3
,...
}
}
Here is an example of using this object to get and print some data:
var dataKeys = [ 'dataKey1', 'key2' ];
personAppData.get( myHandler , 'OWNER_FRIENDS' , dataKeys ); // one function call.. that's it
function myDataHandler( returnedObject ){
// now I can access/iterate through the data
var html = '';
for( var personId in returnedObject ){
html += 'Person Id: ' + personId + ' -- Data: ' + returnedObject[personId].myData + '<br /><br />'; // myData is the data key
}
document.body.innerHTML = html;
}
This object is the result of our Person App Data Tutorial, but is a fairly good start for any program needing to write or retrieve Person App Data. This file should be considered public domain.
To view the code, please use this link: http://www.iwiddit.com/article_xml/personAppData.html
A working xml example can be found here: http://www.iwiddit.com/article_xml/personAppData.xml