To get started, we recommend you create two javascript files, one is DemoDataContext.js that defines your database and entities, and the other is DemoDbService.js that accesses to your database and contains the business logic.

Then, in your index.html, call new DemoDbService().init(callback) ; This method is expected to check database schema version, and init intial data. When you have your database schema changed, you just need to change the constructor call of your DemoDataContext. For example:, "Demo", "1.1", "Demo DB", 1000000);

Also you may need to override the initData of For example:

//note: below code must be after the line of DemoDataContext.constructor = DemoDataContext;
DemoDataContext.prototype.initData = function (callback) {
    //insert initial data to database., callback);

Last edited Mar 19, 2013 at 2:41 PM by leo_2010, version 4


No comments yet.