From 367705cf6826766a9102315d75cd690d8e6b8929 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Wed, 10 Jun 2020 11:52:46 -0500 Subject: fixed add global method in ScriptManager --- src/client/views/nodes/ScriptingBox.tsx | 36 +++------------------------------ 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'src/client/views') diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index c2581240b..61f58cb0f 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -187,7 +187,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { o[p] = "any"; return o; }, {} as ScriptParam); - //const f = new Function(...Array.from(Object.keys(p)), this.rawScript); - - const paramNames = this.compileParams.reduce((o: string, p: string) => { - if (this.compileParams.indexOf(p) === this.compileParams.length - 1) { - o = o + p.split(":")[0].trim(); - } else { - o = o + p.split(":")[0].trim() + ","; - } - return o; - }, "" as string); - const f = new Function(paramNames, this.rawScript); - - let parameters = "("; - this.compileParams.forEach((element: string, i: number) => { - if (i === this.compileParams.length - 1) { - parameters = parameters + element + ")"; - } else { - parameters = parameters + element + ", "; - } - }); - - console.log(this.functionName); - - if (parameters === "(") { - Scripting.addGlobal(f, this.dataDoc.description, "", this.functionName); - } else { - Scripting.addGlobal(f, this.dataDoc.description, parameters, this.functionName); - } + ScriptingBox.DeleteScript?.(this.dataDoc); + ScriptingBox.AddScript?.(this.dataDoc); console.log("created"); } -- cgit v1.2.3-70-g09d2