diff --git a/src/js/playground/compile/__kipper.d.ts b/src/js/playground/compile/__kipper.d.ts new file mode 100644 index 000000000..4d21e5459 --- /dev/null +++ b/src/js/playground/compile/__kipper.d.ts @@ -0,0 +1,10 @@ +// Define global '__kipper' on the window (d.ts file) +export {}; + +declare global { + var __kipper: { [key: string]: any }; + + interface Window { + __kipper: { [key: string]: any }; + } +} diff --git a/src/js/playground/compile/compile-worker.ts b/src/js/playground/compile/compile-worker.ts index 9405c3557..88f1f824e 100644 --- a/src/js/playground/compile/compile-worker.ts +++ b/src/js/playground/compile/compile-worker.ts @@ -12,6 +12,10 @@ let compiler: never | any; * @param code The translated code to evaluate. (Must be in JavaScript) */ async function evalKipperCode(code: string) { + // Clean up any global scope entries + // eslint-disable-next-line no-undef + window.__kipper = __kipper = undefined; + // Overwrite 'console.log' const prevLog = console.log; console.log = (msg: string) => {