diff --git a/package.json b/package.json index 07c258d..6e4b90e 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "scripts": { "start": "webpack serve --open --env mode=development", "build": "rm -rf dist && webpack --env mode=production", - "format": "prettier --write src/*.ts src/*.tsx src/*.css", + "format": "prettier --write src/*.ts src/*.tsx src/*.css src/browser-unit.html", "typecheck": "tsc --noEmit" }, "dependencies": { diff --git a/src/blog-cells.tsx b/src/blog-cells.tsx index 03f7309..977a6e4 100644 --- a/src/blog-cells.tsx +++ b/src/blog-cells.tsx @@ -192,27 +192,27 @@ class Cell extends React.Component< setTimeout(() => resolve(), 500); }); - this.props.kernel.run( - code, - (line) => { - this.setState((state) => { - state.output.push(line); - return state; - }); - }, - async () => { - // Wait the minimum amount of run-time. - await minimumWait; - - this.running = false; - this.setState((state) => { - state.kind = "re-runnable"; - if (state.output.length === 0) - state.output.push({ type: "log", line: "Done." }); - return state; - }); - } - ); + // Run the code. + await this.props.kernel.run(code, (line) => { + this.setState((state) => { + state.output.push(line); + return state; + }); + }); + + // Wait the minimum amount of run-time. + await minimumWait; + + // Mark as not running. + this.running = false; + + // Update the state. + this.setState((state) => { + state.kind = "re-runnable"; + if (state.output.length === 0) + state.output.push({ type: "log", line: "Done." }); + return state; + }); } } diff --git a/src/browser-unit.html b/src/browser-unit.html index 0e26163..345fd4f 100644 --- a/src/browser-unit.html +++ b/src/browser-unit.html @@ -16,36 +16,88 @@