Fix builtins syntax highlighting
This commit is contained in:
11
runcode.ts
11
runcode.ts
@@ -2,8 +2,13 @@
|
||||
const G: any = {
|
||||
eval: eval,
|
||||
};
|
||||
// deno-lint-ignore no-explicit-any
|
||||
const builtins: any = {};
|
||||
const context = new Proxy(G, {
|
||||
get: (target, prop) => {
|
||||
if (prop in builtins) {
|
||||
return builtins[prop as keyof typeof builtins];
|
||||
}
|
||||
return target[prop];
|
||||
},
|
||||
set: (target, prop, value) => {
|
||||
@@ -43,9 +48,9 @@ export const evalCode = (code: string) => {
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export const addToContext = (name: string, value: any) => {
|
||||
G[name] = value;
|
||||
builtins[name] = value;
|
||||
}
|
||||
|
||||
export const getContext = () => {
|
||||
return G;
|
||||
export const getBuiltins = () => {
|
||||
return builtins;
|
||||
}
|
||||
Reference in New Issue
Block a user