From 22d08709d53d16b32e6a9ee8b4b45ebf19bde685 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 19 May 2023 22:48:50 -0400 Subject: fix: nodejs version should not crash --- forth.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/forth.js b/forth.js index 83397c6..84556c1 100644 --- a/forth.js +++ b/forth.js @@ -64,8 +64,13 @@ function forth(print = console.log) { return t => exec(t.split(/[ \n\t]+/)); } +/* +root tag to add to page: +
-if (window) { + * */ + +if (typeof window !== 'undefined') { // browser UI const style = document.createElement('style') style.innerHTML = ` #forthroot * { @@ -120,7 +125,7 @@ if (window) { return false; } -} else { +} else { // UI if NodeJS const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); const prompt = (query) => new Promise((resolve) => rl.question(query, resolve)); -- cgit v1.2.3