[whatwg] Asynchronous database API feedback
Krzysztof Żelechowski
giecrilj at stegny.2a.pl
Wed Dec 12 08:12:49 PST 2007
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
More information about the whatwg
mailing list