Skip to content

Commit a161a74

Browse files
committed
fix: Temporary Save split out Context.ts
1 parent d26b453 commit a161a74

File tree

4 files changed

+2369
-2420
lines changed

4 files changed

+2369
-2420
lines changed

packages/interpreter/example/demo/demo.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ alert("111")
3333

3434
const script1 = 'customVar1 + "--" + customVar2 + "---"';
3535

36-
var initFunc = function (interpreter, globalObject) {
36+
var initFunc = function (context, globalObject) {
3737
// Object
3838
var object = { log: window.console.log };
39-
interpreter.setProperty(globalObject, 'console', interpreter.nativeToPseudo(object));
39+
context.setProperty(globalObject, 'console', context.nativeToPseudo(object));
4040
// Func(同步/异步)
4141
var fun = function alert(text) {
4242
return window.alert(text);
4343
};
44-
interpreter.setProperty(globalObject, 'alert', interpreter.nativeToPseudo(fun));
44+
context.setProperty(globalObject, 'alert', context.nativeToPseudo(fun));
4545
// interpreter.setProperty(globalObject, 'alert', interpreter.createAsyncFunction(fun));
4646
// Other
47-
interpreter.setProperty(globalObject, 'customVar1', 'customVar1');
48-
interpreter.setProperty(globalObject, 'customVar2', 'customVar2');
47+
context.setProperty(globalObject, 'customVar1', 'customVar1');
48+
context.setProperty(globalObject, 'customVar2', 'customVar2');
4949
};
5050

5151
// 使用 Babel 转译代码

0 commit comments

Comments
 (0)