Presentation is loading. Please wait.

Presentation is loading. Please wait.

Google Gears System Requirements Firefox 1.5+,Internet Explorer 6.0+ or Safari 3.1.1+ Windows XP/Vista, Windows Mobile 5+, Mac (Firefox, Safari), Linux.

Similar presentations


Presentation on theme: "Google Gears System Requirements Firefox 1.5+,Internet Explorer 6.0+ or Safari 3.1.1+ Windows XP/Vista, Windows Mobile 5+, Mac (Firefox, Safari), Linux."— Presentation transcript:

1 Google Gears System Requirements Firefox 1.5+,Internet Explorer 6.0+ or Safari 3.1.1+ Windows XP/Vista, Windows Mobile 5+, Mac (Firefox, Safari), Linux and Android.

2 What is Google Gears Open Source Project Enables more powerful web applications. Helps to access and store information on user system in a secure way. Gives Javascript more flexibility and power.

3 Components of Gears Database module WorkerPool module LocalServer module Desktop module Geolocation module

4 Database module Provides relational data storage to JavaScript web application. Uses open-source SQLite database. Browser Javascript have access to view/insert data. Data Files are stored on User using the same- origin security policy.

5 Gears Database Example var db = google.gears.factory.create('beta.database'); db.open('database-test'); db.execute('create table if not exists Test' + ' (Phrase text, Timestamp int)'); db.execute('insert into Test values (?, ?)', ['Monkey!', new Date().getTime()]); var rs = db.execute('select * from Test order by Timestamp desc'); while (rs.isValidRow())‏ { alert(rs.field(0) + '@' + rs.field(1)); rs.next(); } rs.close();

6 WorkerPool Module Injects multi-threading capability in Javascript. Workers (threads) behaves like processes which do not share any execution state. Workers interact each other by sending message.

7 WorkerPool Example // main.js var workerPool = google.gears.factory.create('beta.workerpool'); workerPool.onmessage = function(a, b, message)‏ { alert('Received message from worker ' + message.sender + ': \n' + message.body); }; var childWorkerId = workerPool.createWorkerFromUrl('worker.js'); workerPool.sendMessage(["3..2..", 1, {helloWorld: "Hello world!"}], childWorkerId);

8 WorkerPool Example (Contd.)‏ // worker.js var wp = google.gears.workerPool; wp.onmessage = function(a, b, message) { var reply = message.body[0] + message.body[1] + "... " + message.body[2].helloWorld; wp.sendMessage(reply, message.sender); }

9 LocalServer module Cache and serve its HTTP resources locally, without a network connection. The LocalServer intercepts HTTP/HTTPS requests and serves them from the cache. Two types of LocalServer Management classes are ResourceStore and ManagedResourceStore

10 LocalServer ResourceStore Contents and cache are never updated automatically unless user calls capture(). Example var add_localServer = google.gears.factory.create("beta.localserver","1.0"); var resourceStore = add_localServer.createStore(STORE_NAME); resourceStore.capture(URL, ADDURLCALLBACK);

11 LocalServer ManagedResourceStore ManagedResourceStore are determined by the URLs listed in a manifest file. LocalServer checks for an updated resources periodically via manifest file. Example: var localServer = google.gears.factory.create('beta.localserver'); var store = localServer.createManagedStore('test-store'); store.manifestUrl = 'site-manifest.txt'; store.checkForUpdate();

12 Other APIs Desktop module: It provides an interface for accessing desktop related functionality, such as creating shortcuts. Geolocation module: Obtain the user's current position, and watch the user's position as it changes over time. HttpRequest: provides HttpRequest object to the workers as they don’t have access to brower’s XmlHttpRequest Object. Timer: provides timer capabilities to workers and parent.


Download ppt "Google Gears System Requirements Firefox 1.5+,Internet Explorer 6.0+ or Safari 3.1.1+ Windows XP/Vista, Windows Mobile 5+, Mac (Firefox, Safari), Linux."

Similar presentations


Ads by Google