As discussed in our Google Code Blog post on HTML5 for Gmail Mobile, Google's new version of Gmail for iPhone and Android-powered devices uses the Web Storage Portability Layer (WSPL) to let the same database code run on browsers that provide either Gears or HTML5 structured storage facilities. The WSPL consists of a collection of classes that provide asynchronous transactional access to both Gears and HTML5 databases and can be found on Project Hosting on Google Code.
There are five basic classes:
google.wspl.Statement - A parametrizable SQL statement class
google.wspl.Transaction - Used to execute one or more Statements with ACID properties
google.wspl.ResultSet - Arrays of JavaScript hash objects, where the hash key is the table column name
google.wspl.Database - A connection to the backing database, also provides transaction support
google.wspl.DatabaseFactory - Creates the appropriate HTML5 or Gears database implementation
Also included in the distribution is a simple note-taking application with a persistent database cache built using the WSPL library. This application (along with Gmail mobile for iPhone and Android-powered devices) is an example of the cache pattern for building offline web applications. In the cache pattern, we insert a browser-local cache into the web application to break the synchronous link between user actions in the browser and server-generated responses. Instead, as shown below, we have two data flows. First, entirely local to the device, contents flow from the cache to the UI while changes made by the user update the cache. In the second flow, the cache asynchronously forwards user changes to the web server and receives updates in response.
By using this architectural pattern, a web application can made tolerant of a flaky (or even absent) network connection!
We'll be available at the Developer Sandbox at Google I/O to discuss the cache pattern, HTML5 development and the WSPL library. Check it out! If you have questions or comments, please visit our discussion list.
Friday, 29 May 2009
Web Storage Portability Layer: A Common API for Web Storage
Recent Posts
- New Google Tricks: 15+ Cool and Amazing Secret Hidden Google Tricks
- Weekend Tech News: Battlegrounds Mobile India gameplay, WhatsApp policy canceled?, OPPO foldable phone
- PUBG Mobile India release date: Relaunching as Battlegrounds Mobile India officially announced
- Difference B/W Blogs & Websites Things People Haven't Told You
- Watch Live IPL 2021: How to watch today's Live streaming of IPL 2021? All Methods
Related tricks
- August Penguin 10th annual meeting in Israel
- Introducing the Mobile Bookmark Bubble
- Web Storage Portability Layer: A Common API for Web Storage
- Support for Mercurial Now Available for All Projects Hosted on Google Code
- How to Design Flat Email Signup Widget With Text Animated Effect
- Setup, Install and Test Mozilla Firefox Mobile OS On Windows, Mac & Linux PC Desktop - Tutorial
- How the world was open sourced
(+)