Commit 3f014a42 authored by rockyl's avatar rockyl

暴露globalContext

parent 38573477
...@@ -2075,9 +2075,9 @@ ...@@ -2075,9 +2075,9 @@
metaConfig = this._meta; metaConfig = this._meta;
if (!metaConfig) return [3, 3]; if (!metaConfig) return [3, 3];
if (!metaConfig.script) return [3, 2]; 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(); this.updateProps();
return [4, func(payload, this._config.props)]; return [4, func(payload, this._config.props, this._vm.getGlobalContext())];
case 1: case 1:
result = _a.sent(); result = _a.sent();
_a.label = 2; _a.label = 2;
...@@ -2204,7 +2204,7 @@ ...@@ -2204,7 +2204,7 @@
} }
} }
}; };
VM.prototype.getGlobal = function () { VM.prototype.getGlobalContext = function () {
return this._globalContext; return this._globalContext;
}; };
return VM; return VM;
......
This diff is collapsed.
...@@ -91,9 +91,9 @@ export class Process { ...@@ -91,9 +91,9 @@ export class Process {
let metaConfig = this._meta; let metaConfig = this._meta;
if (metaConfig) { if (metaConfig) {
if (metaConfig.script) { if (metaConfig.script) {
let func = new Function('args', 'props', warpAsyncScript(metaConfig.script)); let func = new Function('args', 'props', 'global', warpAsyncScript(metaConfig.script));
this.updateProps(); this.updateProps();
result = await func(payload, this._config.props); result = await func(payload, this._config.props, this._vm.getGlobalContext());
} }
} else { } else {
console.warn(`process meta [${meta}] not found`) console.warn(`process meta [${meta}] not found`)
......
...@@ -37,7 +37,7 @@ export class VM { ...@@ -37,7 +37,7 @@ export class VM {
} }
} }
getGlobal(){ getGlobalContext(){
return this._globalContext; 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