JAVASCRIPT LIBRARY ISOLATION
JavaScript library isolation can include replacing instances of a read/write call to a particular object from JavaScript code of a user interface (UI) plugin to a hosting application with a proxy as the JavaScript code is compiled to a JavaScript file, defining a function by which the proxy operates, directing a first subset of read/write calls to the particular object in runtime according to the function, and redirecting a second subset of read/write calls to a different object in runtime according to the function.
1 . A method, comprising:
replacing instances of a read/write call to a particular object from browser script code of a user interface (UI) plugin to a hosting application with a proxy as the browser script code is compiled to a browser script file;
defining a function by which the proxy operates;
directing a first subset of read/write calls to the particular object in runtime according to the function; and
redirecting a second subset of read/write calls to a different object in runtime according to the function.
2 . The method of claim 1 , further comprising making the function global to the particular object.
3 . The method of claim 1 , wherein the runtime comprises runtime of a browser;
wherein the particular object comprises a browser window object;
wherein the different object comprises a separate application in the browser window.
4 . The method of claim 3 , wherein the first subset of read/write calls were originally directed to a browser window resource having functionality built into the browser.
5 . The method of claim 4 , wherein the second subset of read/write calls comprise read/write calls other than those originally directed to the browser window resource having functionality built into the browser.
6 . The method of claim 1 , wherein the hosting application comprises a cloud services platform UI; and
wherein the method further comprises borrowing, by the UI plugin, JavaScript library dependencies from the cloud services platform UI.
7 . The method of claim 6 , further comprising supporting multiple versions of the JavaScript library simultaneously in a browser without causing a conflict for different states, classes, or functions having a same name between the multiple versions of the JavaScript library.
8 . The method of claim 1 , comprising defining the function at runtime.
9 . The method of claim 1 , comprising replacing respective instances of the read/write call to the particular object from respective browser script code of each of a plurality of versions of the UI plugin with the proxy as the respective JavaScript code is compiled to respective browser script files.
10 . A non-transitory machine-readable medium having instructions stored thereon which, when executed by a processor, cause the processor to:
replace instances of a read/write call to a particular object from JavaScript code of a first version of a user interface (UI) plugin to a hosting application with a proxy as the JavaScript code of the first version of the UI plugin is compiled;
replace instances of the read/write call to the particular object from JavaScript code of a second version of a UI plugin to the hosting application with the proxy as the JavaScript code of the second version of the UI plugin is compiled;
define a function by which the proxy operates;
direct a first subset of read/write calls from the first version and the second version of the UI plugin to the particular object in runtime according to the function; and
redirect a second subset of read/write calls from the first version and the second version of the UI plugin to a different object in runtime according to the function.
11 . The medium of claim 10 , further comprising instructions to:
replace instances of the read/write call to the particular object from JavaScript code of a third version of a UI plugin to the hosting application with the proxy as the JavaScript code of the third version of the UI plugin is compiled;
direct all read/write calls from the third version of the UI plugin to the particular object in runtime according to the function.
12 . The medium of claim 10 , wherein the function dictates that all read/write calls from any version of the UI plugin developed for a same version of a JavaScript library as the hosting application be directed to the particular object.
13 . The medium of claim 12 , wherein the first version and the second version of the UI plugin were developed for different versions of the JavaScript library than the hosting application.
14 . The medium of claim 10 , wherein the first subset of read/write calls comprise read/write read/write calls originally directed to a browser window resource having functionality built into the browser; and
wherein the different object comprises a separate application in the browser window.
15 . The medium of claim 10 , wherein the first version of the UI plugin was developed for a first version of a JavaScript library;
wherein the hosting application uses a second version of the JavaScript library; and
further comprising instructions to present, by the hosting application, a browser window to a user of the first version of the UI plugin without conflict for different states, classes, or functions having a same name between the first and the second versions of the JavaScript library.
16 . A system, comprising:
processing and memory resources configured to:
provide a cloud services platform user interface (UI);
support a plurality of versions of a UI plugin hosted by the cloud services platform UI with a current version of a JavaScript library of the cloud services platform UI;
replace instances of a read/write call to a particular object from JavaScript code of each UI plugin to the cloud services platform UI with a proxy as the JavaScript code is compiled to a JavaScript file;
define a function by which the proxy operates;
direct a first subset of read/write calls to the particular object in runtime according to the function; and
redirect a second subset of read/write calls to a different object in runtime according to the function.
17 . The system of claim 16 , wherein the runtime comprises runtime of a browser; and
wherein the particular object comprises a browser window object; and
wherein the different object comprises an object other than the browser window.
18 . The system of claim 17 , wherein the different object comprises a separate application in the browser window; and
wherein the first subset of read/write calls were originally directed to a browser window resource having functionality built into the browser.
19 . The system of claim 16 , wherein the processing and memory resources are further configured to support the use of multiple versions of the JavaScript library by the plurality of versions of a UI plugin simultaneously in a browser.
20 . The system of claim 19 , wherein the processing and memory resources are further configured to make the function global to the particular object.