From aa8b76c267d33fa6ab96bc97fdd77c46bc2bc826 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 22 Aug 2022 13:34:23 -0700 Subject: [PATCH] core: cleanup script --- plugins/core/src/script.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/core/src/script.ts b/plugins/core/src/script.ts index 1ddec4921..59a895422 100644 --- a/plugins/core/src/script.ts +++ b/plugins/core/src/script.ts @@ -12,9 +12,7 @@ export class Script extends ScryptedDeviceBase implements Scriptable, Program, S } async saveScript(source: ScriptSource): Promise { - this.storage.setItem('data', JSON.stringify({ - 'script.ts': source.script, - })); + this.storage.setItem('data', JSON.stringify(source)); } async loadScripts(): Promise<{ [filename: string]: ScriptSource; }> { @@ -92,7 +90,7 @@ export class Script extends ScryptedDeviceBase implements Scriptable, Program, S } } - async eval(source: ScriptSource, variables: { [name: string]: any }) { + async eval(source: ScriptSource, variables?: { [name: string]: any }) { this.prepareScript(); const { value, defaultExport } = await scryptedEval(this, source.script, Object.assign({