Apr 16
Aaron Boodman wrote a fantastic post on Gears and Standards which I am very passionate about myself.
In it he talks about the HTML5 Storage API and how we are all working together to unify the database access semantics.
You can see the Database 2 API which aims too:
- Enable Javascript developers to easily write code that works with both Gears and browser database APIs
- Reduce developer “mind-print” by implementing the same API that is available in browsers
- Support the proposed HTML5 database standard with an implementation available for all browsers that Gears supports
- Implement an asynchronous API that can be called from the UI thread without freezing the UI
- Implement a synchronous API to simplify usage inside workers
- Implement a thread pool abstraction that can be used in other modules for asynchronous operations (bonus)
- build a new module from scratch using the new Dispatcher model (bonus).
It would allow you to write code such as:
var dbman = goolge.gears.factory.create('beta.databasemanager'); var db = dbman.open('pages', '0.0.1.0', 'Collection of crawled pages', 3000000); function renderPageRow(row) { // insert page row into a table } function reportError(source, message) { // report an error } function renderPages() { db.transaction(function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Pages(title TEXT, lastUpdated INTEGER)', []); tx.executeSql('SELECT * FROM Pages', [], function(rs) { for(var i = 0; i < rs.rows.length; i++) { renderPageRow(rs.rows.item(i)); } }) }) } function insertPage(text, lastUpdated) { db.transaction(function(tx) { tx.executeSql('INSERT INTO Pages VALUES(?, ?)', [ text, lastUpdated ], function() { // no result returned, stub success callback }, function(tx, error) { reportError('sql', error.message); }); }); }
There is a full technical design, so you can get involved and take part in the open source / open community process that we have going on in Gears land.
I will again end with my visualization of the zipper :)
September 16th, 2008 at 5:53 am
when this will be integrated with Gears?
also is there any synchronous API,because it is alot easier to write synchronous code and let a worker handle it in the background than writing nested function async code,also it is bad if you want to write a ORM :)
January 22nd, 2009 at 1:37 am
Do you know if there is some extend to print() API in the future of Google Geras?
From my personal point of view this wold be the killer API of GG!
March 3rd, 2009 at 2:54 am
Hi Dion, what tool did you use for creating the zipper? I am guessing with PS am I write ?
March 3rd, 2009 at 2:54 am
sorry right not write :)