electron/spec/fixtures/api/utility-process/eval.js

6 lines
213 B
JavaScript

const vm = require('node:vm');
const contextObject = { result: 0 };
vm.createContext(contextObject);
vm.runInContext('eval(\'result = 42\')', contextObject);
process.parentPort.postMessage(contextObject.result);