1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    416
    Vote Rating
    18
    Answers
    5
    jweber will become famous soon enough

      0  

    Default Unanswered: sencha create jsb not working with onReady

    Unanswered: sencha create jsb not working with onReady


    When I use sencha create jsb, the file it creates doesn't contain any of my application's dependencies.

    I'm using Sencha Tools 2.0.0 Developer Preview with Sencha Touch 2.0b2, and sencha-touch-debug.js.

    My app.js file is below. I'm using an onReady function so I can load some data into a store, before calling Ext.application. When I run sencha create jsb -a http://localhost/index.html , it prints "onReady" but not "launch".

    Code:
    Ext.Loader.setConfig({
    	enabled: true
    });
    Ext.onReady(function() {
    	console.log('onReady');
    	....
    	myModel.load(null, {
    		success: function(record, operation) {
    			Ext.application({
    				...
    				launch: function() {
    					console.log('launch');
    				}
    			});
    		}
    	});
    I also noticed that when I test this app in the browser, I don't get any warnings about needing to use Ext.require for my application's dependencies. It just loads them silently. Is this expected?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You shouldn't do Ext.onReady (or Ext.setup) if using Ext.application.

    Code:
    Ext.application({
        ...
        launch: function() {
            myModel.load(null, {
                success: function(record, operation) {
                    console.log('launch');
                }
            });
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    416
    Vote Rating
    18
    Answers
    5
    jweber will become famous soon enough

      0  

    Default


    But what if I want to do things before the application is launched, like loading data into a Store? I could start loading it in my launch function. But when that returns, Ext will immediately find the current URL, and call its router function. I don't want this to happen until the store is loaded.

    Also, even if it's not recommended, why would this work in a browser but not in Sencha Tools? I'm trying to get a better understanding of how the tools work, so I can make sure they include all the right files.

Thread Participants: 1

Tags for this Thread