Hello, I have a question regarding loading a Javascript library. I'm building an application that builds components with the reusability, and for that the structure of each component would be created like this:
//componente foo
.foo = {
style : "foo.css",
template : "foo.html",
script : "script.js",
"imgDir" : "img",
//etc...
};
Thinking of a logic to facilitate the maintenance and reuse of these components, and also in the class system of a strongly typed application I have the interest to include all dependencies of the scripts of this component in the same component, so if such a script was not loaded before, it should be for only then the system to run.
I took this idea to prevent loading the same library from require_once
of PHP. Is there any way to, I force the DOM to see if the script already exists on the page so it does not occur from the same duplicate link from it? It occurred to me in another moment and it ended up that the new insertion of Jquery kinda stopped my application because it was recreating the contents of a library inside the document and with that I lost instances and methods already declared and in use. p>