Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    9
    Vote Rating
    0
    pixelated is on a distinguished road

      0  

    Default How to include my own javascript files (crosspost from discussion)

    How to include my own javascript files (crosspost from discussion)


    Sencha Touch won't 'see' third-party JavaScripts once the system has been compiled into production and deployed remotely.

    As a result, any third-party JavaScripts become useless and any part of the system that relies on them will cease to function.

    During development, they work fine.

    This thread (original post) sums it up nicely: http://www.sencha.com/forum/showthre...vascript-files

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Vote Rating
    827
    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


    When you generate your app and you develop some app, where do you include the 3rd party code?
    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
    Nov 2012
    Posts
    9
    Vote Rating
    0
    pixelated is on a distinguished road

      0  

    Default


    Hi Mitchell, I'm adding it in within the app.json file
    Code:
        "js": [
            {
                "path": "assets/lib/JavaScriptUtil.js",
                "update": "delta",
                "remote": true
            },
            {
                "path": "assets/lib/Parsers.js",
                "update": "delta",
                "remote": true
            },
            {
                "path": "assets/lib/InputMask.js",
                "update": "delta",
                "remote": true
            },
            {
                "path": "sdk/sencha-touch.js"
            },
            {
                "path": "app.js",
                "bundle": true,
                "update": "delta"
            },
    However the only way I've been able to get the libraries to work (after production compilation) is to include them as explicit script tags within index.html:
    HTML Code:
        <script src="assets/lib/JavaScriptUtil.js"></script>
        <script src="assets/lib/Parsers.js"></script>
        <script src="assets/lib/InputMask.js"></script>
    I've tried changing the order of elements in the json file, combining the third-party libs into one file and all manner of other options.

    As soon as the system/app has been compiled, third-party libs cease to be seen by the app. However, the libs are loaded as if there is a syntax error in the files, webkit will output an error and the app may even stop working.

    For example, the 3 libraries I've included are dependant on each other ( InputMask.js <- Parsers.js <- JavaScriptUtil.js ) After compilation, InputMask.js throws an error in WebKit because it's unable to see Parsers.js (well, it's unable to see the class within Parsers.js). Combining the 3 dependent libs within one file solves that issue but the app still can't see the included classes.

    That's why I'm totally confused. WebKit loads the files but the app cannot see their contents.

Thread Participants: 1