Hi James.
The opensocial.DataRequest.send() method accepts an optional parameter
-- a function object which should be invoked when the response is
received. In your case, _handleData() is executed when viewer
information is available. So place any dependent code in
_handleRequest (or a function that is called from _handleRequest) and
this should work.
Please let me know if this helps or if there's something I missed.
- Jason
On Feb 6, 12:23 pm, James Murray <[EMAIL PROTECTED]> wrote:
> I'm using prototype 1.6 in my project, Just so you know.
>
> so i have this JS class that looks like this:
>
> var Spiral = Class.create({
> data:null,
> initialize: function()
> {
> var req = opensocial.newDataRequest();
> req.add(req.newFetchPersonRequest("VIEWER"), 'viewer');
>
> req.send(this._handleData.bindAsEventListener(this));
> },
>
> _handleData: function(data)
> {
> this.data = data;
> },
>
> })
>
> then I instance it:
>
> var spiral = new Spiral();
>
> well I'm having problems with the fact that the DataRequest is
> asynchronous, I need to know when the DataRequest is done so i can
> continue to do what I plan on doing with the data.
>
> After the line that instances the Spiral class runs, the DataRequest
> is still going, if I try to operate on the data after I instance my
> class I will most defiantly receive an error.
>
> How can I either make it synchronous, or check that the DataRequest is
> finished?
>
> Any help is appreciated
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenSocial API Definition" 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/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---