Wednesday, February 27th, 2008

gearsAJAXHelper: Using Gears as an optional speed boost

Category: Gears, Google, JavaScript, Performance

>Ben Lisbakken, who sits 100 feet away from me, developed gearsAJAXHelper, a library that bridges the AJAX search and feed APIs with Gears, to get a speed improvement:

We decided it would be cool to write a small library to make it easy for you AJAX APIs developers to write quick-loading, always fresh searches/feeds. The gearsAJAXHelper has two main features – it allows you to store and return key/value pairs from the local database, and it allows you to choose whether you want all resources files on the page (images, CSS, Javascript, HTML) to automatically be cached in the Gears cache.

The key/value pair database feature let’s you store the query/results as a key/value pair. Then, the next time the query is made, the results can be served from the database while fresh results are being retrieved. This dramatically reduces the latency in queries/feed grabs.

The (optional) automatic cacheing of resource files will make it so that each time the user visits your webpage they will be getting resources served from their Google Gears cache, not new versions from the internet. Be careful when using this feature, as you might not want stale content to be served. There is also a refresh function, to clear the Google Gears cache of old files.

You can take a look at the sample, that saves the content for presidential candidates so if you click back on an area, you get instant loads.

gearsAJAXHelper Example

The bulk of the API is:

javascript
< view plain text >
  1. gearsAJAXHelper.initialize("election", "election", false);
  2. gearsAJAXHelper.storeKeyVal(key, value);
  3. gearsAJAXHelper.returnKeyVal(key);
  4. gearsAJAXHelper.refresh();

This example shows how you can optional add super-caching to your applications with technology such as Gears. It ‘aint just about offline!

NOTE: JavaScript Hackathon

If you are in the bay area, and like JavaScript (and if not, why are you on this blog!), then join us at Google this Friday for a Google Developer Hackathon focusing on JavaScript.

There will be two sessions — one from 2:00PM – 5:30PM and another from 6:00PM – 10:00PM. You are welcome to stay for both. Please RSVP

Where: Google Campus: 1600 Amphitheatre Pkwy, Mountain View, CA 94043. It will be held in the Seville Tech Talk room.

Related Content:

Posted by Dion Almaer at 7:56 am
1 Comment

++++-
4 rating from 9 votes

1 Comment »

Comments feed TrackBack URI

Yup it’s more than offline, as i found out a few months back
http://hamisageek.blogspot.com/2007/06/speeding-up-loading-time-by-using.html
you can also use it to improve performance.

However, your users still need gears to be installed though.

Comment by hgcphoenix — February 27, 2008

Leave a comment

You must be logged in to post a comment.