Announcement

Collapse
No announcement yet.

application with external dependencies

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • application with external dependencies

    Hi,

    I have an application written in pure html & javascript, now I want to convert it to OX AppSuite's application. I then write register.js file like below:

    register.js
    PHP Code:
    define('my.namespce/myapp/register', ['my.namespace/myapp/myclass'], function (myclass) {
        ...
    }); 
    myclass in turn, require lots of external scripts & most of them are utility module which are included into dom tree by <script> tag in the old fashion style.

    The question is: How can I include those dependencies?

    Thanks

  • #2
    OX App Suite uses RequireJS, so if your external dependencies are AMD modules, or have any other kind of support for RequireJS, you could try to use that.

    Otherwise, you can use
    Code:
    //@include [I]filename[/I]
    to include plain JavaScript inside your own module without polluting the global namespace. The filename should be relative to the directory of the JavaScript file in which this include directive appears.

    Comment


    • #3
      Hi Vik,

      Unfortunately, neither the //@include nor require() does work

      For example: in register.js I include/require lib1.js & mod1.js. mod1.js has some calls to lib1.js functions. Build tool failed to work with method not found error.

      The build tool also doesn't work & stop with "'<something>' not defined" error when I call browser's api. For example: calling to webkitURL() method of Chrome will raise 'webkitURL' not defined & the builder refuses to continue.
      Last edited by dollylamb; 02-17-2014, 06:22 AM.

      Comment


      • #4
        The build system uses JSHint to check the source. You can customize the errors and warnings either globally for your app using a .jshintrc file or locally using comments. The preferred method is to add the native APIs to the "global" option, so that JSHint knows, what's an API and what's a typo.

        Comment

        Working...
        X