Re: ISSUE-3 (async-style): Asynchrnonous calls style [APIs — General]

On Aug 31, 2009, at 21:12 , Arve Bersvendsen wrote:
> On Tue, 25 Aug 2009 15:08:36 +0200, Device APIs and Policy Working  
> Group Issue Tracker <sysbot+tracker@w3.org> wrote:
>> ISSUE-3 (async-style): Asynchrnonous calls style [APIs — General]
>>
>> http://www.w3.org/2009/dap/track/issues/3
>>
>> Raised by: Robin Berjon
>> On product: APIs — General
>>
>> We need to pick a common style for asynchronous calls (handles for  
>> cancellation, DOM Events or not, etc.).
>
> I'll ask the same question I did for ISSUE-2: Do we really? Whether  
> something is a callback or event, or is cancellable or not would  
> depend on the particular use-case, no?

I'm fine with that if that's the general feeling of the WG, but at the  
very least rough guidelines about when to use events or callbacks  
could help. The WebApps WG recently tailspinned into several weeks of  
not-always-friendly discussion about events versus callbacks — I'd  
rather we avoided that.

Here's a quick proposal, feel free to add to or subtract from it:

  - Every asynchronous call should be cancellable, unless there are  
overriding technical issues that make the action irreversible (e.g.  
window.dropPiano()).

  - Events will be used whenever there is a solid use case indicating  
decentralised observation or the need for simulating the action  
(synthetic events); otherwise callbacks will be used.

-- 
Robin Berjon - http://berjon.com/

Received on Tuesday, 1 September 2009 09:58:16 UTC