google gears system requirements firefox 1.5+,internet explorer 6.0+ or safari 3.1.1+ windows...

12
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.

Upload: veronica-ward

Post on 13-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 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

Google Gears

System RequirementsFirefox 1.5+,Internet Explorer 6.0+ or Safari 3.1.1+

Windows XP/Vista, Windows Mobile 5+, Mac (Firefox, Safari), Linux and Android.

Page 2: 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

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.

Page 3: 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

Components of Gears

Database module WorkerPool module LocalServer module Desktop module Geolocation module

Page 4: 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

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.

Page 5: 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

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();

Page 6: 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

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.

Page 7: 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

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);

Page 8: 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

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);

}

Page 9: 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

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

Page 10: 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

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);

Page 11: 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

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();

Page 12: 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

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.