diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-10 23:23:45 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-10 23:23:45 -0500 |
commit | c974c54c22e79618f7589288887224efaf369dac (patch) | |
tree | 015a272c4ab713f80415a813250e304541ae0434 /src/client/util/Scripting.ts | |
parent | efb6c50a4ed80554ccf9163ad0bbb144d6d75ff7 (diff) |
fixed addScriptToGlobals in ScriptManager
Diffstat (limited to 'src/client/util/Scripting.ts')
-rw-r--r-- | src/client/util/Scripting.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/util/Scripting.ts b/src/client/util/Scripting.ts index f618a9e6e..1cc193bc3 100644 --- a/src/client/util/Scripting.ts +++ b/src/client/util/Scripting.ts @@ -58,11 +58,8 @@ export namespace Scripting { let n: any; let obj: any; - console.log("adding global"); - if (second !== undefined) { if (typeof first === "string") { - console.log("name first"); n = first; obj = second; } else { @@ -71,6 +68,7 @@ export namespace Scripting { if (third !== undefined) { obj.push(third); } + console.log("are we here"); n = first.name; } } else if (first && typeof first.name === "string") { @@ -84,6 +82,7 @@ export namespace Scripting { } else if (_scriptingGlobals.hasOwnProperty(n)) { throw new Error(`Global with name ${n} is already registered, choose another name`); } + console.log(n); _scriptingGlobals[n] = obj; } @@ -97,8 +96,10 @@ export namespace Scripting { export function removeGlobal(name: string) { if (getGlobals().includes(name)) { + //if (_scriptingGlobals.container[name]) { delete _scriptingGlobals.container[name]; return true; + //} } return false; } @@ -113,7 +114,7 @@ export namespace Scripting { } export function getGlobals() { - return Object.keys(scriptingGlobals); + return Object.keys(_scriptingGlobals); } export function getGlobalObj() { |