@readable-js/core
Version:
ReadableJS is a toolkit for teachers to craft small demos that can be explored interactively.
19 lines (18 loc) • 787 B
TypeScript
/**
* Prepare the code following https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
* recommendation.
*/
export declare function prepareEvalCode(code: string, argsStr: string[]): string;
/**
* Prepare the code following https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval
* recommendation.
*
* And execute it.
*
* NOTE: I have no idea in which context the code will get run. It has access to global object like window though.
* But probably doesn't have access to the scope in which `runCodeWith` is called. I tried one or two thing
* with binding `this`, without success.
*/
export declare function runCodeWith(code: string, args?: Map<string, any>): {
returned: any;
};