资 源 简 介
```
//Every asynchronous call requires coding callbacks.
// Sample Code:
//
// The code below first retrieves the list of discussion groups from the rpcService in a callback
// Next retrieves the list of discussions from the rpcService in another callback
// Finally retrieves and processes the list of messages from the rpcService from a callback
(function() {
rpcService.getDiscussionGroups();
rpcService.onComplete = function(groups) {
for each (var group in groups) {
rpcService.getDiscusionsForGroup(group);
rpcService.onComplete = function(discussions) {
for each (var discussion in discussions) {
rpcService.getMessages(discussion);
rpcService.onComplete = function(messages) {
//do something
}
}
};
}
}
})();
//Compare the sample above