Re: Web API Design Cookbook

Robin et al,

Thanks for pushing this forward.

I have received few questions from the Tizen team about the preferred
style related to asynchronous operations. In the cookbook you outlined few
options in chapter 5.

Which would be the better style for asynchronous operations: callbacks or
DOM events?

- Some W3C APIs (Contacts, Calendar, Messaging, Geolocation, ...) pass
success/error callbacks as argument to methods.

- Some more recent W3C specs (FileAPI, FileWriter, IndexedDB) use DOM
Events.

Seems that Mozilla B2G is moving towards DOM events in their
implementation [1].

So is there any preferred way, or is it just pick what ever you feel like?

Another question is related to notifications. That is,

- Some W3C APIs (geolocation, systeminfo) use watchChanges()/clearWatch()
style with callbacks.

- Recent W3C specs ( FileAPI, FileWriter, IndexedDB, battery, sensors)
uses DOM Events.

Any preferred way here as well?

-sakari

[1] https://bugzilla.mozilla.org/attachment.cgi?id=559360



On 11/10/11 7:05 AM, "Robin Berjon" <robin@berjon.com> wrote:

>Hi all,
>
>several people (notably Bryan) have been asking for a repository of
>common practices in designing Web APIs. This has also been discussed in
>WebApps and the Script Library CG.
>
>I've taken a few ideas I heard, fleshed out one of the sections as an
>example, and put it up at:
>
>    http://scriptlib-cg.github.com/api-design-cookbook/
>
>The source is on GitHub (it will also be synced to the W3C server):
>
>    https://github.com/scriptlib-cg/api-design-cookbook
>
>Everyone is welcome to contribute (either recipes or empty sections
>calling out the need for one). The way to do this is through the usual
>GitHub development process: fork, modify, and make a pull request to the
>editor.
>
>Editing is handled from an organisation account, and I'm happy to add
>people to the organisation.
>
>-- 
>Robin Berjon - http://berjon.com/ - @robinberjon
>
>

Received on Tuesday, 22 November 2011 18:52:44 UTC