W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2007

[whatwg] Asynchronous database API feedback

From: Krzysztof Żelechowski <giecrilj@stegny.2a.pl>
Date: Wed, 12 Dec 2007 17:12:49 +0100
Message-ID: <1197475970.7016.20.camel@a1dmin.vola.spe.com.pl>

Dnia 11-12-2007, Wt o godzinie 11:22 -0800, Aaron Boodman pisze:
> With an asynchronous API, it gets quite a bit messier. Here's an
> example of what it might look like:
> 
> var messages = incoming_data;
> 
> db.transaction(function(tx) {
>   processNextMessage(tx);
> });
> 
> function processNextMessage(tx) {
> 
>   if (!messages.length) return;
> 
>   tx.executeSql("insert into messages (id, subject, body) values (?, ?, ?)", [
> }

Please, it is only a matter of programming style.  You can get used to
it, really.  I actually prefer the code above to a synchronous one.
Chris
Received on Wednesday, 12 December 2007 08:12:49 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:38 UTC