Oracle jet import js functions in other js pages










0















Is there something in Oracle Jet that allows you to include a JavaScript file inside another JavaScript file?



I have my first.js with a lot of functions that I'd like to use in other js pages without copy and paste.



I found this question in pure javascript and in particular the John Strickler's answer con match because Oracle Jet use Require Js.



https://docs.oracle.com/middleware/jet320/jet/developer/GUID-15EA25E7-4CA3-45DE-835A-7ED903332722.htm#JETDG330.



But I have problem with loading my page after I have included first page in define.



I'd like to have my functions in appController/main js and can use in all other modules but I don't know if it is possible.



Thank you.










share|improve this question
























  • developer.mozilla.org/en-US/docs/web/javascript/reference/…

    – t3__rry
    Nov 13 '18 at 10:50











  • thanks. Have you use it in oracle jet? It doesn't seem that oracle can accept these statement

    – Vittorio Albanese
    Nov 13 '18 at 13:03















0















Is there something in Oracle Jet that allows you to include a JavaScript file inside another JavaScript file?



I have my first.js with a lot of functions that I'd like to use in other js pages without copy and paste.



I found this question in pure javascript and in particular the John Strickler's answer con match because Oracle Jet use Require Js.



https://docs.oracle.com/middleware/jet320/jet/developer/GUID-15EA25E7-4CA3-45DE-835A-7ED903332722.htm#JETDG330.



But I have problem with loading my page after I have included first page in define.



I'd like to have my functions in appController/main js and can use in all other modules but I don't know if it is possible.



Thank you.










share|improve this question
























  • developer.mozilla.org/en-US/docs/web/javascript/reference/…

    – t3__rry
    Nov 13 '18 at 10:50











  • thanks. Have you use it in oracle jet? It doesn't seem that oracle can accept these statement

    – Vittorio Albanese
    Nov 13 '18 at 13:03













0












0








0








Is there something in Oracle Jet that allows you to include a JavaScript file inside another JavaScript file?



I have my first.js with a lot of functions that I'd like to use in other js pages without copy and paste.



I found this question in pure javascript and in particular the John Strickler's answer con match because Oracle Jet use Require Js.



https://docs.oracle.com/middleware/jet320/jet/developer/GUID-15EA25E7-4CA3-45DE-835A-7ED903332722.htm#JETDG330.



But I have problem with loading my page after I have included first page in define.



I'd like to have my functions in appController/main js and can use in all other modules but I don't know if it is possible.



Thank you.










share|improve this question
















Is there something in Oracle Jet that allows you to include a JavaScript file inside another JavaScript file?



I have my first.js with a lot of functions that I'd like to use in other js pages without copy and paste.



I found this question in pure javascript and in particular the John Strickler's answer con match because Oracle Jet use Require Js.



https://docs.oracle.com/middleware/jet320/jet/developer/GUID-15EA25E7-4CA3-45DE-835A-7ED903332722.htm#JETDG330.



But I have problem with loading my page after I have included first page in define.



I'd like to have my functions in appController/main js and can use in all other modules but I don't know if it is possible.



Thank you.







javascript jquery requirejs oracle-jet






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 10:44









Rory McCrossan

242k29206245




242k29206245










asked Nov 13 '18 at 10:37









Vittorio AlbaneseVittorio Albanese

11




11












  • developer.mozilla.org/en-US/docs/web/javascript/reference/…

    – t3__rry
    Nov 13 '18 at 10:50











  • thanks. Have you use it in oracle jet? It doesn't seem that oracle can accept these statement

    – Vittorio Albanese
    Nov 13 '18 at 13:03

















  • developer.mozilla.org/en-US/docs/web/javascript/reference/…

    – t3__rry
    Nov 13 '18 at 10:50











  • thanks. Have you use it in oracle jet? It doesn't seem that oracle can accept these statement

    – Vittorio Albanese
    Nov 13 '18 at 13:03
















developer.mozilla.org/en-US/docs/web/javascript/reference/…

– t3__rry
Nov 13 '18 at 10:50





developer.mozilla.org/en-US/docs/web/javascript/reference/…

– t3__rry
Nov 13 '18 at 10:50













thanks. Have you use it in oracle jet? It doesn't seem that oracle can accept these statement

– Vittorio Albanese
Nov 13 '18 at 13:03





thanks. Have you use it in oracle jet? It doesn't seem that oracle can accept these statement

– Vittorio Albanese
Nov 13 '18 at 13:03












1 Answer
1






active

oldest

votes


















1














Oracle JET uses requireJS for loading modules (and files) dynamically.



Documentation can be found on: https://requirejs.org/



What you will need to do to is "transform" your first.js file to a module "format" so that RequireJS can load it and "expose" your functions.
Check the documentation for more info: https://requirejs.org/docs/api.html#define



If you have done that, you can use your module anywhere you want and thus don't need copy/pasta.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279139%2foracle-jet-import-js-functions-in-other-js-pages%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Oracle JET uses requireJS for loading modules (and files) dynamically.



    Documentation can be found on: https://requirejs.org/



    What you will need to do to is "transform" your first.js file to a module "format" so that RequireJS can load it and "expose" your functions.
    Check the documentation for more info: https://requirejs.org/docs/api.html#define



    If you have done that, you can use your module anywhere you want and thus don't need copy/pasta.






    share|improve this answer



























      1














      Oracle JET uses requireJS for loading modules (and files) dynamically.



      Documentation can be found on: https://requirejs.org/



      What you will need to do to is "transform" your first.js file to a module "format" so that RequireJS can load it and "expose" your functions.
      Check the documentation for more info: https://requirejs.org/docs/api.html#define



      If you have done that, you can use your module anywhere you want and thus don't need copy/pasta.






      share|improve this answer

























        1












        1








        1







        Oracle JET uses requireJS for loading modules (and files) dynamically.



        Documentation can be found on: https://requirejs.org/



        What you will need to do to is "transform" your first.js file to a module "format" so that RequireJS can load it and "expose" your functions.
        Check the documentation for more info: https://requirejs.org/docs/api.html#define



        If you have done that, you can use your module anywhere you want and thus don't need copy/pasta.






        share|improve this answer













        Oracle JET uses requireJS for loading modules (and files) dynamically.



        Documentation can be found on: https://requirejs.org/



        What you will need to do to is "transform" your first.js file to a module "format" so that RequireJS can load it and "expose" your functions.
        Check the documentation for more info: https://requirejs.org/docs/api.html#define



        If you have done that, you can use your module anywhere you want and thus don't need copy/pasta.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 8:09









        User404User404

        1,88122127




        1,88122127



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279139%2foracle-jet-import-js-functions-in-other-js-pages%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            政党

            天津地下鉄3号線