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
    17
    Vote Rating
    3
    Trayak is on a distinguished road

      0  

    Default Am I able to use an external Js resource in Sencha Native app?

    Am I able to use an external Js resource in Sencha Native app?


    REQUIRED INFORMATION
    Architect Build tested:
    • Build: 676
    Project Type:
    • Touch 2.1
    Description:
    • I've created a very simple native app using Sencha Architect/Sencha Touch 2.1. I added a JS Resource. The JS file only declares a global variable. I find that I can access the variable in the JS resource if I bring up the app in a browser. If I create a native app and try to bring up the variable value (through a message box or something similar), I find that the variable is inaccessible. Is it possible to access an external JS resource code in a native app?
    Steps to reproduce the problem:
    • Create a simple application with a JS Resource that contains a global variable with a string value.
    • Use something like a message box to display the variable value.
    • Create a native app and try the application in the iOS simulator (or on your iPad or iPhone).
    The result that was expected:
    • I expect to be able to use a JS resource.
    The result that occurs instead:
    • Unable to use the JS resource
    Operating System:
    • Mac OSX

  2. #2
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,920
    Vote Rating
    63
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      0  

    Default


    Be sure that the index.html file that gets created when you package has been updated from the app.html. If you add the js resource after Architect made a copy of the app.html > index.html it will not again update it. This is because we wouldn't want you to lose any customizations.

    Be sure index.html has the script include
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    17
    Vote Rating
    3
    Trayak is on a distinguished road

      0  

    Default


    Thanks that was it. A nice enhancement might be to recognize if there are no customizations to automatically update the index.html or at least to let the user know to make sure to update the file.

    Thanks for the help.

    Brian

  4. #4
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,920
    Vote Rating
    63
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      0  

    Default


    It's very subtle but you do get a notification to update that file when you run package build/simulate

    I agree we should improve this step
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    17
    Vote Rating
    3
    Trayak is on a distinguished road

      0  

    Default


    You are correct. The message makes sense now. Unfortunately, the terminal window that gives the updates of the build usually covers the message and the message goes away too quickly. Also, by the time the message comes up, isn't it "too late"? Meaning the build has already used the out of date index.html?

    Thanks,

    Brian

  6. #6
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,920
    Vote Rating
    63
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      0  

    Default


    *sheepish* yes it's too late.

    Any ideas for improved workflow?

    If not index.html exists this is when we create one.

    I suspect in the near future we'll be building using Sencha Cmd which creates a whole different folder build/theme/production as an example
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  7. #7
    Sencha User
    Join Date
    Nov 2012
    Posts
    17
    Vote Rating
    3
    Trayak is on a distinguished road

      1  

    Default


    I would suggest using the "Sencha Cmd Setup" dialog in Sencha Architect to improve the workflow for recognizing and needing to update the index.html that is generated. At the very least, putting the warning on the dialog would notify the user prior to the user hitting the "Simulate" or "Build" buttons. Optionally, you can give us a button to "regenerate" the index.html (and obviously overwrite the user's changes). Another idea is to give us a way to hand edit the index.html file from this dialog (without needing to go to some other editor).

    Brian

Thread Participants: 1