diff --git a/index.html b/index.html index e108803..895b1e2 100644 --- a/index.html +++ b/index.html @@ -80,7 +80,7 @@
Karlkode 1.0
+
-const lib = karlkoder.lib();
+export const lib = karlkoder.lib();
lib.clear("green");
diff --git a/src/code_runner.js b/src/code_runner.js
index d80799c..0b4cf3f 100644
--- a/src/code_runner.js
+++ b/src/code_runner.js
@@ -15,6 +15,7 @@ export class CodeRunner {
async run() {
this.isRunning = true;
+ this.console.clear();
this.console.log("Running code...");
this.codeStopper.start();
@@ -57,7 +58,7 @@ export class CodeRunner {
}
// Evaluate code
- const func = new Function(`"use strict";return ${code}`);
+ const func = new Function(`"use strict";let console=playgroundConsole;return ${code}`);
try {
const result = func();
diff --git a/src/gamelib.js b/src/gamelib.js
index e8f3e41..4e5ebce 100644
--- a/src/gamelib.js
+++ b/src/gamelib.js
@@ -40,7 +40,7 @@ export class Gamelib {
try {
loopFunction(deltaT);
} catch (error) {
- this.console.log(error);
+ this.console.error(error);
}
}, 16);
diff --git a/src/index.js b/src/index.js
index 43e23ab..223dfc1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -19,6 +19,10 @@ const playgroundConsole = new PlaygroundConsole(
document.querySelector("#console-code"),
);
+window.addEventListener('DOMContentLoaded', () => {
+ playgroundConsole.log("Karlkode 1.0");
+});
+
const codeStopper = new CodeStopper();
const spriteProvider = new SpriteProvider();
diff --git a/src/playground_console.js b/src/playground_console.js
index b3b510f..04476a9 100644
--- a/src/playground_console.js
+++ b/src/playground_console.js
@@ -31,4 +31,8 @@ export class PlaygroundConsole {
el.textContent = "" + text;
this.elem.appendChild(el);
}
+
+ clear() {
+ this.elem.textContent = "";
+ }
}
diff --git a/style.css b/style.css
index 1d9b5a9..25832e6 100644
--- a/style.css
+++ b/style.css
@@ -351,11 +351,8 @@ footer {
transition: border-color 200ms ease-in-out;
}
-#project-name:hover, #project-name:active {
+#project-name:hover, #project-name:focus {
border-color: white;
-}
-
-#project-name:focus {
outline: none;
}