mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 16:52:18 +00:00
core: cleanup script
This commit is contained in:
@@ -12,9 +12,7 @@ export class Script extends ScryptedDeviceBase implements Scriptable, Program, S
|
||||
}
|
||||
|
||||
async saveScript(source: ScriptSource): Promise<void> {
|
||||
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({
|
||||
|
||||
Reference in New Issue
Block a user