Commit 3f014a42 authored by rockyl's avatar rockyl

暴露globalContext

parent 38573477
......@@ -2075,9 +2075,9 @@
metaConfig = this._meta;
if (!metaConfig) return [3, 3];
if (!metaConfig.script) return [3, 2];
func = new Function('args', 'props', warpAsyncScript(metaConfig.script));
func = new Function('args', 'props', 'global', warpAsyncScript(metaConfig.script));
this.updateProps();
return [4, func(payload, this._config.props)];
return [4, func(payload, this._config.props, this._vm.getGlobalContext())];
case 1:
result = _a.sent();
_a.label = 2;
......@@ -2204,7 +2204,7 @@
}
}
};
VM.prototype.getGlobal = function () {
VM.prototype.getGlobalContext = function () {
return this._globalContext;
};
return VM;
......
This diff is collapsed.
......@@ -91,9 +91,9 @@ export class Process {
let metaConfig = this._meta;
if (metaConfig) {
if (metaConfig.script) {
let func = new Function('args', 'props', warpAsyncScript(metaConfig.script));
let func = new Function('args', 'props', 'global', warpAsyncScript(metaConfig.script));
this.updateProps();
result = await func(payload, this._config.props);
result = await func(payload, this._config.props, this._vm.getGlobalContext());
}
} else {
console.warn(`process meta [${meta}] not found`)
......
......@@ -37,7 +37,7 @@ export class VM {
}
}
getGlobal(){
getGlobalContext(){
return this._globalContext;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment