javascript - Dynamically loading multiple JS scripts where scripts are all described identically -


I have an interesting problem that I am unsure of how best to solve

I have a JS The scripts that contain the following are:

  var obj = new namespace.MyObjectName ("key", [12, 11, 22, 33, 454, 552], 222], [33, 22 , 33, 11, 22, 222, 111]); Namespace.me ObjectName = function (key name, data1, data2) {this.myData1 = data1; This.myData2 = Data2; This.holder = [[keyName, [myData1, myData2]]]; }; Namespace.may objectname.prototype.dosing = function (arg1, argArray) {For visual purposes "+ ergrere [0] +" & lt; Br> Using the string "this = globelvar =", "display" + Arg1 + "for visual purposes" + argArray [2] + "
< P> Automation is making copies of these JS files, each has the same declaration of the above given object, in which the file names are on the lines of:

  • file1 .js
  • file2.js

The difference per file is that the DoSomething method name content is always different / as the array goes to the manufacturer

All of the above were fine only during the lifetime of J. S..


What I want to do now is HTML page load 1 or more these files are dynamic (Compared to the code to be written later), for which I might go along, although every script declares the object

Here are some options I am considering: / P>

  1. Write js to this By the time that every script file object is on a specific namespace, but with the master piece of JS code in the HTML at the time of loading it is registered in any way, which keeps on relying all the object references
    • Write to HTML that each script is loaded on the fence-off path (as I know, there is no way to do this in JS, but I may be wrong)
    • Some other It is unknown that

is towards my current bias (1), but I am putting all the things for discussion because the approach has the underlying problems Can be displayed clearly about others or others. It is possible to run Javascript in the sandbox, using an iframe, for example:

(2) Dean Edwards or '' for


Comments