0.9 Proposal - Clarify timing of callback execution in JS API

0 views
Skip to first unread message

Louis Ryan

unread,
Oct 23, 2008, 4:49:01 PM10/23/08
to opensocial-an...@googlegroups.com
One issue that has cropped up between implementations has been the timing of when a callback function gets called.

Consider the case of requestPermission(permissions, reason, opt_callback). Implementations which do no implement support for this synchronously call the opt_callback function with a 'not implemented' response, other implementations will use XHR to resolve this and so the callback will be asynch. This is creating implementation dependencies in gadgets on the timing of callback execution. It seems friendlier to guarantee that all callbacks are asynchronous and allow developers to rely on a consistent behavior across containers.

I'd like to propose that we require in the specification that the callback function will not be called until after the existing call stack has completed. This can trivially be achieved by using window.setTimeout(<callback closure>, 0);

-Louis

Zhen Wang

unread,
Oct 23, 2008, 5:06:16 PM10/23/08
to opensocial-an...@googlegroups.com
+1 All opt_callback functions should be fired asynchronously.

Scott Seely

unread,
Oct 23, 2008, 7:08:56 PM10/23/08
to opensocial-an...@googlegroups.com

+1

Shishir Birmiwal

unread,
Oct 24, 2008, 2:48:22 PM10/24/08
to opensocial-an...@googlegroups.com
+1
I agree, this makes a lot of sense.
--

Quentin Crisp  - "If at first you don't succeed, failure may be your style."

Chris Chabot

unread,
Oct 26, 2008, 9:47:36 AM10/26/08
to opensocial-an...@googlegroups.com
+1 on the ground of makes-perfect-sense-and-thanks-for-catching-it :)

Scott Seely

unread,
Oct 27, 2008, 1:07:03 PM10/27/08
to opensocial-an...@googlegroups.com

Looks like 5 votes (I assume the author is an auto +1).

Louis Ryan

unread,
Oct 27, 2008, 1:11:56 PM10/27/08
to opensocial-an...@googlegroups.com
That must be a record :)

Scott Seely

unread,
Oct 29, 2008, 4:12:29 PM10/29/08
to OpenSocial - OpenSocial and Gadgets Specification Discussion
Draft Spec has been updated. Pages/JS updated:

http://sites.google.com/site/opensocialdraft/Home/opensocial-javascript-api-reference/datarequest
http://sites.google.com/site/opensocialdraft/Home/opensocial-javascript-api-reference/opensocial
http://sites.google.com/site/opensocialdraft/Home/gadgets-api-specification/gadgets-io
http://sites.google.com/site/opensocialdraft/Home/gadgets-api-specification/gadgets-util
http://sites.google.com/site/opensocialdraft/Home/gadgets-api-specification/gadgets-tab
http://sites.google.com/site/opensocialdraft/Home/gadgets-api-specification/gadgets-minimessage
http://sites.google.com/site/opensocialdraft/Home/gadgets-api-specification/gadgets-rpc

Please review and respond to this thread if you have any concerns.

On Oct 27, 10:11 am, "Louis Ryan" <lr...@google.com> wrote:
> That must be a record :)
>
> On Mon, Oct 27, 2008 at 10:07 AM, Scott Seely <sSe...@myspace.com> wrote:
> >  Looks like 5 votes (I assume the author is an auto +1).
>
> > *From:* opensocial-an...@googlegroups.com [mailto:
> > opensocial-an...@googlegroups.com] *On Behalf Of *Chris Chabot
> > *Sent:* Sunday, October 26, 2008 6:48 AM
> > *To:* opensocial-an...@googlegroups.com
> > *Subject:* [opensocial-and-gadgets-spec] Re: 0.9 Proposal - Clarify timing
> > of callback execution in JS API
>
> > +1 on the ground of makes-perfect-sense-and-thanks-for-catching-it :)
>
> > On Fri, Oct 24, 2008 at 7:48 PM, Shishir Birmiwal <birmi...@google.com>
> > wrote:
>
> > +1
> > I agree, this makes a lot of sense.
>
> > On Fri, Oct 24, 2008 at 4:38 AM, Scott Seely <sSe...@myspace.com> wrote:
>
> > +1
>
> > *From:* opensocial-an...@googlegroups.com [mailto:
> > opensocial-an...@googlegroups.com] *On Behalf Of *Zhen Wang
> > *Sent:* Thursday, October 23, 2008 2:06 PM
> > *To:* opensocial-an...@googlegroups.com
> > *Subject:* [opensocial-and-gadgets-spec] Re: 0.9 Proposal - Clarify timing
Reply all
Reply to author
Forward
0 new messages