javascript - Define execution context of external JS file? -


I am working on a small JS library which I want to be able to use in various projects.

My problem is: I need some data that is defined in some files from another JS project in which I do not control the source code. These files are structured as follows:

  (export () {var export; export export = type export! == "undefined" & export! == Zero? Export: This; export oz. ??? ??? ...;}). Call (this);   

Now, I can prevent global namespace pollution by defining a export variable in global area area.

However, I need to work in parallel with another script anytime if exportObj = type export ... pattern, as I have all the definitions from that script Also catch me

Anyway, I can define the value of this is it necessary to include me to use external JS files for execution? In this way, I can redirect the definitions in a variable of my choosing, without any other script that really influences the global export variable

< div class = "post-text" itemprop = "text">

It is possible to wrap the contents of those files in the same pattern, such as

  (function () {( function) () {var exportObj; exportObj = typesof export! == "undefined" & amp; amp; and export! == empty export: this; export obje. ??? = ...;}) Call (this);}) .call (yourNamespace);   

If you do not control the source, you can try proxying it through your server and wrap it for you. You can also try to bring scripts in the form of text, wrap it in the customer and then put it both way that is, but perhaps the easiest way to fix the problem without interference and cunning.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -