Impel.inTouch: Remote or Local Database Synchronization

74 views
Skip to first unread message

CC

unread,
May 9, 2009, 6:06:45 AM5/9/09
to phonegap
Cheers to everyone building PhoneGap. It freaking rocks.
I'm waiting on approval from Apple for my Japanese and JLPT Flash
Cards (http://www.kanjitastic.com/) app and am ecstatic that I could
use most of my web app JavaScript directly in the iPhone app.

In the meantime it seems a good idea to contribute some of my code
back here. In particular I thought some might find it useful to be
able to synchronize the local database with a remote server, or load
an initial set of tables and data.

Impel.inTouch is one of the modules of an HTML5 Javascript ORM that I
am developing, but it can happily live on it's own. When you fire off
the Impel.inTouch's sync method it will use JsonP to retrieve a file
listing all the tables that you want to duplicate locally. Then one at
a time it will download those files, create any necessary tables and
load any data necessary. The files can be local to the app or hosted
on a remote server.

The API is and basic usage documentation is here:
http://www.kanjitastic.com/impel/api/inTouch/symbols/Impel.inTouch.html
The JavaScript source with comments is here:
http://www.kanjitastic.com/impel/dist/impel.inTouch-source.js
The YUI compressed version is here: http://www.kanjitastic.com/impel/dist/impel.inTouch.js


Finally, a quick snippet showing how to use it to synchronize from the
local file system the first time the app is used and remotely
thereafter.
http://www.kanjitastic.com/en/blog/incrementally_synchronize_html5_databases_from_remote_or_local_sources.html

One thing to note on the snippet is that it makes reference to
localStorage, which doesn't exist on the iPhone. I've written a class
that emulates localStorage using the HTML5 database. I'll make it
available soon. Until then you can accomplish the same thing using
cookies.

Really, really last thing is that Impel.inTouch currently requires the
MooTools library. If Impel.inTouch proves to be useful to you and you
need the MooTools dependency pulled out tell me. I'll make it a
priority if it is a priority for enough people.

Samuel Michelot

unread,
May 10, 2009, 11:08:34 AM5/10/09
to phonegap
Great contribution ! Great work !
A synchronised database is very usefull. I plan to developp an
application with this feature, and I am sure I am not the only one.
I checked out the documentation, and it looks simple and well
explained.
For the Mootools dependency, if it's simple to remove it, it would be
great. Personnaly, I use JQuery, and I don't really want to have
another library (with possible conflicts problems..).
Thanks for your sharing

On May 9, 12:06 pm, CC <caleb.cr...@gmail.com> wrote:
> Cheers to everyone building PhoneGap. It freaking rocks.
> I'm waiting on approval from Apple for my Japanese and JLPT Flash
> Cards (http://www.kanjitastic.com/) app and am ecstatic that I could
> use most of my web app JavaScript directly in the iPhone app.
>
> In the meantime it seems a good idea to contribute some of my code
> back here. In particular I thought some might find it useful to be
> able to synchronize the local database with a remote server, or load
> an initial set of tables and data.
>
> Impel.inTouch is one of the modules of an HTML5 Javascript ORM that I
> am developing, but it can happily live on it's own. When you fire off
> the Impel.inTouch's sync method it will use JsonP to retrieve a file
> listing all the tables that you want to duplicate locally. Then one at
> a time it will download those files, create any necessary tables and
> load any data necessary. The files can be local to the app or hosted
> on a remote server.
>
> The API is and basic usage documentation is here:http://www.kanjitastic.com/impel/api/inTouch/symbols/Impel.inTouch.html
> The JavaScript source with comments is here:http://www.kanjitastic.com/impel/dist/impel.inTouch-source.js
> The YUI compressed version is here:http://www.kanjitastic.com/impel/dist/impel.inTouch.js
>
> Finally, a quick snippet showing how to use it to synchronize from the
> local file system the first time the app is used and remotely
> thereafter.http://www.kanjitastic.com/en/blog/incrementally_synchronize_html5_da...

Ron Braithwaite

unread,
May 12, 2009, 9:45:53 PM5/12/09
to phon...@googlegroups.com
Absolutely fabulous! I wasn't looking forward to having to do this
myself and so this is a real gift from the goddess.

Like Samuel, it would be great if it didn't require Mootools (I'm
using xui).

Thanks again for a great gift to the community!

-Ron
Reply all
Reply to author
Forward
0 new messages