假设您有脚本 A: 定义了一个库:
class MathFunctions { add(a, b) => { return a+b; } }
你有脚本 B: 以某种方式重用 MathFunctions:
const mf = import MathFunctions;
console.log(mf.add(2, 2));
并且你想在 vm 上下文中执行 B,导入 A。
使用不受信任的代码执行此操作的最佳方法是什么?
假设您有脚本 A: 定义了一个库:
class MathFunctions { add(a, b) => { return a+b; } }
你有脚本 B: 以某种方式重用 MathFunctions:
const mf = import MathFunctions;
console.log(mf.add(2, 2));
并且你想在 vm 上下文中执行 B,导入 A。
使用不受信任的代码执行此操作的最佳方法是什么?