I am new to this OpenSocial Api , So I need help

This is the function given in OpenSocial Tutorial (OpenSocial API
v0.8)

function giveGift() {
  var nut = document.getElementById('nut').value;
  var friend = document.getElementById('person').value;

  givenGifts[friend] = nut;
  var json = gadgets.json.stringify(givenGifts);

  var req = opensocial.newDataRequest();
  req.add(req.newUpdatePersonAppDataRequest("VIEWER", 'gifts', json));
  '''req.add(req.newFetchPersonRequest("VIEWER"), 'viewer');

  var viewerFriends = opensocial.newIdSpec({ "userId" : "VIEWER",
"groupId" : "FRIENDS" });
  var opt_params = {};
  opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100;
  req.add(req.newFetchPeopleRequest(viewerFriends, opt_params),
'viewerFriends');

  var viewer = opensocial.newIdSpec({ "userId" : "VIEWER" });
  req.add(req.newFetchPersonAppDataRequest(viewer, 'gifts'),
'data');'''
  req.send(onLoadFriends);
}


I want to know what exactly this lines of codes are doing :

"""
  givenGifts[friend] = nut;
  var json = gadgets.json.stringify(givenGifts);

  var req = opensocial.newDataRequest();
  req.add(req.newUpdatePersonAppDataRequest("VIEWER", 'gifts', json));
  '''req.add(req.newFetchPersonRequest("VIEWER"), 'viewer');
"""

and

"""
  var viewer = opensocial.newIdSpec({ "userId" : "VIEWER" });
  req.add(req.newFetchPersonAppDataRequest(viewer, 'gifts'),
'data');'''
  req.send(onLoadFriends);
"""

I am getting little bit confused about this lines of code , Please
help me friends

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to