Skip to content

Commit

Permalink
Make more methods private
Browse files Browse the repository at this point in the history
  • Loading branch information
cbebe committed Sep 24, 2024
1 parent 0f3e0ea commit 7c7e92f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/website/assets/js/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class WebInterpreter extends HTMLElement {
* @param {string} text
* @returns
*/
insertText(text) {
#insertText(text) {
const encoder = new TextEncoder();
const bytes = encoder.encode(text);

Expand All @@ -33,7 +33,7 @@ class WebInterpreter extends HTMLElement {
return [addr, bytes.length];
}

logText(addr, length) {
#logText(addr, length) {
const memory = this.#wasm.exports.memory;
const bytes = memory.buffer.slice(addr, addr + length);
const decoder = new TextDecoder("UTF-8");
Expand All @@ -44,10 +44,10 @@ class WebInterpreter extends HTMLElement {
#newRunner() {
const go = new Go();
go.importObject["main.go.printError"] = (addr, length) => {
console.error(this.logText(addr, length));
console.error(this.#logText(addr, length));
};
go.importObject["main.go.printOut"] = (addr, length) => {
console.log(this.logText(addr, length));
console.log(this.#logText(addr, length));
};
go.importObject.env = {
printError: go.importObject["main.go.printError"],
Expand Down Expand Up @@ -96,7 +96,7 @@ class WebInterpreter extends HTMLElement {
if (!this.#wasm) return;
// @ts-expect-error
const inputText = this.querySelector("textarea.input").value;
const [addr, len] = this.insertText(inputText);
const [addr, len] = this.#insertText(inputText);
this.#wasm.exports.goFysh(addr, len);
});
}
Expand Down

0 comments on commit 7c7e92f

Please sign in to comment.