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

前端 未结 4 1975
甜味超标
甜味超标 2020-12-08 22:37

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 ac

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 23:12

    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,

    • Include the following line in your index.html. microloader is the folder that is shipped with sencha sdk and contains three files mainly, development.js, production.js and testing.js , each one for it's own purpose.

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

    • Then, in your folder, you will need to have a file called as app.json. It will look something like this ..
    {
        "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"
            }
        ],
    
        .....
        .....
        .....
     }
    

提交回复
热议问题