Oracle jet import js functions in other js pages
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
add a comment |
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
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
add a comment |
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
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
javascript jquery requirejs oracle-jet
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 20 '18 at 8:09
User404User404
1,88122127
1,88122127
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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