tidy up args for Isolated VM class

This commit is contained in:
Martin McKeaveney 2024-01-02 10:29:57 +00:00
parent 8f1470f5a5
commit 51c0494b0f
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ class ScriptRunner {
constructor(script: string, context: any) {
const code = `let fn = () => {\n${script}\n}; results.out = fn();`
this.vm = new IsolatedVM(8)
this.vm = new IsolatedVM({ memoryLimit: 8 })
this.vm.context = {
data: context.data,
params: context.params,
@ -29,7 +29,7 @@ class IsolatedVM {
jail: ivm.Reference
script: any
constructor(memoryLimit: number) {
constructor({ memoryLimit }: { memoryLimit: number }) {
this.isolate = new ivm.Isolate({ memoryLimit })
this.vm = this.isolate.createContextSync()
this.jail = this.vm.global