Add a user manual
This commit is contained in:
28
runcode.ts
28
runcode.ts
@@ -1,9 +1,20 @@
|
||||
// deno-lint-ignore no-explicit-any
|
||||
const G: any = {
|
||||
eval: eval,
|
||||
};
|
||||
// deno-lint-ignore no-explicit-any
|
||||
const builtins: any = {};
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
const G: any = {};
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export const addToContext = (name: string, value: any) => {
|
||||
builtins[name] = value;
|
||||
}
|
||||
|
||||
export const getBuiltins = () => {
|
||||
return builtins;
|
||||
}
|
||||
|
||||
addToContext("eval", eval);
|
||||
|
||||
const context = new Proxy(G, {
|
||||
get: (target, prop) => {
|
||||
if (prop in builtins) {
|
||||
@@ -44,13 +55,4 @@ export const evalCode = (code: string) => {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export const addToContext = (name: string, value: any) => {
|
||||
builtins[name] = value;
|
||||
}
|
||||
|
||||
export const getBuiltins = () => {
|
||||
return builtins;
|
||||
}
|
||||
Reference in New Issue
Block a user