PDA

View Full Version : Script loader



r4nd7263
4 Aug 2011, 4:18 AM
Does the framework have script loader function similar to that of Head JS (http://headjs.com/)? We are experiencing long startup time and are looking for ways to defer script loading.

Head JS helps, but we rather not use it if the same can be done in Sencha Touch.

mitchellsimoens
4 Aug 2011, 8:22 AM
Are you just wanting to delay the firing of the setup method?

r4nd7263
5 Aug 2011, 7:09 AM
Are you just wanting to delay the firing of the setup method?

No, I want to delay loading of script file.

Say I have:

Index.html
Main.js
View1.js
View2.js

I only need Main.js and View1.js for startup. I don't need View2.js until User click on a button on View1.js.

With Head JS, I can declare Main.js and View1.js in index.html. And load View2.js when User clicks a button on View1.

Example:


myHandleOnClick : function() {
head.js(
"https://domain/app/helper/myHelper.js", function() {
// after script load
new App.MyHelper().showView2();
});
}


My question is: does Sencha Touch have similar method? and where to find an example? Thanks.

hitman01
9 Sep 2011, 12:26 PM
mitchellsimoens,

How can I delay the setup of sencha (not using the MVC)?