HTML5 SQL Player
Notably, this wrapper is very faithful to the spec. Everything is asynchronous where it is supposed to be -- even opening a transaction is non-blocking, just as it is in the spec.
This is done by implementing a client-server protocol between a Gears WorkerPool (the server) and the wrapper API (the client). Each SQL statement the client needs to execute is proxied to the server using
SendMessage()
and the client waits for an asynchronous callback containing the result. A typical SQL transaction will contain many statements and these all must be routed to the same Gears Database object on the server.For an interesting read, check out the source. It is a really good example of mapping an single-threaded asynchrous API to a synchronous multi-threaded one.
It's nice to see this work being done. It shows that as long as the basic web development model of JavaScript/CSS/DOM is preserved, developers can deal with pretty dramatic API differences.
No comments:
Post a Comment