-
8 Oct 2012 8:13 PM #1
Unanswered: Question about app startup order: developement and package/tesing build.
Unanswered: Question about app startup order: developement and package/tesing build.
Question about app startup order: developement and package/tesing build.
I am implementing custom sqlite proxy and define in Model definition. I also add code at app onReady to init stuff.
In developement enviroment, the startup order is: app's onReady -> models 's proxy init, which is OK
But when i build testing/package using sencha command (Sencha 2.1 beta and Sencha CMD v190): models 's proxy init - > app's onReady , which is NG for my case.
How can i work around it.
Thank you and best regards.
My code
The model:
and on application i add code in onReadyCode:Ext.define('XXX', { extend : 'Ext.data.Model', requires : ['XXX.util.InitSQLite'], config : { fields : [{ name : 'id', type : 'int' }, { name : 'body', type : 'auto' }, { name : 'story_id', type : 'string' }], proxy : { type : 'sqlitestorage', dbConfig : { tablename : 'xxx', dbConn : XXX.util.InitSQLite.getConnection() } } } });
Ext.application({
....
Code:Ext.application({ .... onReady : function() { DftStory.util.InitSQLite.initDb(); },
-
8 Oct 2012 8:47 PM #2
onReady?why not launch?
I write English by translator.
-
8 Oct 2012 9:36 PM #3
app's onReady is lauched but the execution order is diffirent between development and build enviroment.
In development enviroment, execution order which is OK
1. app's onReady
2. model's proxy initialization
In package/testing build, execution order is reversed which is NG
1. model's proxy initialization
2. app's onReady
Thank for your reply.
-
8 Oct 2012 10:14 PM #4
Code:Ext.define('XXX', { extend : 'Ext.data.Model', requires : ['XXX.util.InitSQLite'], config : { fields : [{ name : 'id', type : 'int' }, { name : 'body', type : 'auto' }, { name : 'story_id', type : 'string' }], proxy : { type : 'sqlitestorage', dbConfig : { tablename : 'xxx', dbConn : (function(){ DftStory.util.InitSQLite.initDb(); return XXX.util.InitSQLite.getConnection() })() } } } });I write English by translator.
-
9 Oct 2012 2:58 AM #5
Thank you haduki.
I tried but the models' proxy init process is still run before the app onready event which should be run first as usual in development enviroment.
I also tried to modify the order off class definition in app.js which is generated by testing/package build but still no luck.


Reply With Quote