sencha-touchsencha-touch-2

What is the proper way to load an external javascript in Sencha Touch 2


In my development I need to include third part javascripts; like money.js (http://josscrowcroft.github.com/money.js/)

What is the best 'clean'/'proper' way to achieve it ? Just include it in index.html ?


Solution

  • No. Don't directly add the additional javascript files in the index.html file. That is not the recommended way (though it may work).

    Instead, do like this,

    < script id ="microloader" type="text/javascript" src="../../microloader/development.js"> < /script >

    {
        "name": "Sencha",
    
         // All javascript files go here ...
        "js": [
            {
                "path": "../../sencha-touch-all-debug.js"
            },
            {
                "path": "app.js",
                "update": "delta"
            },
            { 
                "path": "http://josscrowcroft.github.com/money.js/",
                "update": "delta"  
            }
        ],
        "css": [
            {
                "path": "../../resources/css/sencha-touch.css",
                "update": "delta"
            },
            {
                "path": "resources/css/app.css",
                "update": "delta"
            }
        ],
    
        .....
        .....
        .....
     }