Thursday, August 9th, 2007

Sync Progress and Contact Management with Gears

Category: Examples, Gears

A couple of Gears samples have been released.

Arjun Kalura has created a
database sync module
that shows the progress of a sync between a remote database, and a local one. The example also uses the worker pool to execute SQL in its own thread and hence keeping the user interface freed up to show the progress report on how the sync process is going.

Gears Progress Indicator

Steve Yen of TrimPath has created a bare bones contact sample that shows you how to use the Junction framework (which is Rails-esque in JavaScript).

You can handle migrations via:

javascript

  1. TrimPath.junctionDbMigrate = {
  2.  
  3.   '/db/migrate/0001_contact.js' : { up: function() {
  4.     createStandardTable('Contact',
  5.       column('first_name',     'varchar(100)'),
  6.       column('last_name',      'varchar(100)'),
  7.       column('address',        'varchar(300)'),
  8.       column('phone',          'varchar(100)')
  9.     );
  10.   },
  11.   down: function() {
  12.     dropTable('Contact');
  13.   }
  14. },
  15.   done: null
  16. }

Validate your model:

javascript

  1. with (modelFor('Contact')) {
  2.     validatesPresenceOf('first_name');
  3.     validatesPresenceOf('last_name');
  4. }

and much more.

Posted by Dion Almaer at 10:55 am
Comment here

+++--
3.5 rating from 22 votes

Comments Here »

Comments feed TrackBack URI

Leave a comment

You must be logged in to post a comment.