Exception when calling script include from a different script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2020 01:32 PM
Hi,
encountering a sporadic error when trying to call a different script include.
var mySI = "MyOtherSciptInclude";
var k = new global[mySI]();
In my testing, the above code will work 90% of the time. When it does fail, my try/catch reports: undefined is not a function
Any insight/suggestions would be appreciated.
Patrick
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2020 09:12 AM
HI Muhammad,
thanks for your response.
The type is a string and we have been testing this over the last day or so with mixed results.
One thing I neglected to mention was that (ref my initial code snippet) the code is leveraging the JSUtil script include/getGlobal func. Looks like the latest ver of JSUtil does not include this func.
Thanks
Patrick
var global = JSUtil.getGlobal();
var mySI = "MyOtherSciptInclude";
var k = new global[mySI]();
** JSUtil code snippet **
/*
* Returns the Rhino global object.
*/
JSUtil.getGlobal = function(){
return (function(){
return this;
}).call(null);
};