Make onEmit log to console by default

This commit is contained in:
Remko Tronçon 2022-05-06 21:47:00 +02:00
parent 55647e0200
commit a11c7a10ea

View file

@ -49,6 +49,18 @@ class WAForth {
constructor() {
this.#fns = {};
this.onEmit = (() => {
// Default emit that logs to console
let buffer: string[] = [];
return (c: string) => {
if (c === "\n") {
console.log(buffer.join(""));
buffer = [];
} else {
buffer.push(c);
}
};
})();
}
/**