[whatwg] Asynchronous database API feedback

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