-2
I have three files:
Arquivo1.js
function main() {
. . .
}
Arquivo2.js
function main() {
. . .
}
System js
function openApp(package) {
var a = document.createElement("script");
a.src = "/" + package + "/Arquivo1.js";
document.body[0].appendChild(a);
}
How do I call main()
of Arquivo1 without affecting the main()
of Arquivo2 inside the System file, which is the head...
I’ve written this post on the original stackoverflow, but no one answered...
EDIT: I updated the code, I want everything to be standardized!
And as I do this a system of Packages, identical to android, well, I have a function that records the Avascripts by folders, if the package is "a.a.a", the folder will be a.a.a/js/main.js, and would have to be standard for all files, because the system is within a function...
– EduApps
Then in that case I would have to write package + Arquivo1.main?
– EduApps
Well, I think I understand your problem correctly. The System is responsible for adding the functions to the html file and you access these functions later, correct?
– João Pedro Henrique
Yes, exact.....
– EduApps
Well, in that case I would recommend you to use modules: https://developers.google.com/web/fundamentals/primers/modules#browser, or use a bundler to compile all your code in one file, such as Webpack https://webpack.js.org/
– João Pedro Henrique