From df170f53e2c88bd77a552e42b2eba5470b15cb03 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Thu, 9 Apr 2020 02:31:19 -0400 Subject: cleaned up some scriptingBox code -- added parameters --- src/client/util/Scripting.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/client/util/Scripting.ts') diff --git a/src/client/util/Scripting.ts b/src/client/util/Scripting.ts index f97d91d10..57d22eaf8 100644 --- a/src/client/util/Scripting.ts +++ b/src/client/util/Scripting.ts @@ -24,6 +24,8 @@ export interface ScriptError { export type ScriptResult = ScriptSucccess | ScriptError; +export type ScriptParam = { [name: string]: string }; + export interface CompiledScript { readonly compiled: true; readonly originalScript: string; @@ -37,6 +39,12 @@ export interface CompileError { } export type CompileResult = CompiledScript | CompileError; +export function isCompileError(toBeDetermined: CompileResult): toBeDetermined is CompileError { + if ((toBeDetermined as CompileError).errors) { + return true + } + return false +} export namespace Scripting { export function addGlobal(global: { name: string }): void; -- cgit v1.2.3-70-g09d2