From cbcd7e282a48dc3fcb94d8c5835f5ce66317d06b Mon Sep 17 00:00:00 2001 From: John Starich Date: Sun, 1 Aug 2021 00:04:54 -0500 Subject: [PATCH] Update global object name to hackpad --- internal/global/init.go | 2 +- server/src/App.js | 2 +- server/src/{GoWASM.js => Hackpad.js} | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) rename server/src/{GoWASM.js => Hackpad.js} (83%) diff --git a/internal/global/init.go b/internal/global/init.go index ad14e72..16840a8 100644 --- a/internal/global/init.go +++ b/internal/global/init.go @@ -4,7 +4,7 @@ package global import "syscall/js" -const globalKey = "goWasm" +const globalKey = "hackpad" var globals js.Value diff --git a/server/src/App.js b/server/src/App.js index ec30997..8132d48 100644 --- a/server/src/App.js +++ b/server/src/App.js @@ -5,7 +5,7 @@ import './Tabs.css'; import '@fortawesome/fontawesome-free/css/all.css'; import Compat from './Compat'; import Loading from './Loading'; -import { install, run, observeGoDownloadProgress } from './GoWASM'; +import { install, run, observeGoDownloadProgress } from './Hackpad'; import { newEditor } from './Editor'; import { newTerminal } from './Terminal'; diff --git a/server/src/GoWASM.js b/server/src/Hackpad.js similarity index 83% rename from server/src/GoWASM.js rename to server/src/Hackpad.js index 5d62955..2b76d69 100644 --- a/server/src/GoWASM.js +++ b/server/src/Hackpad.js @@ -18,18 +18,18 @@ async function init() { 'PATH': '/bin:/home/me/go/bin:/usr/local/go/bin/js_wasm:/usr/local/go/pkg/tool/js_wasm', } go.run(cmd.instance) - const { goWasm, fs } = window - console.debug(`hackpad status: ${goWasm.ready ? 'ready' : 'not ready'}`) + const { hackpad, fs } = window + console.debug(`hackpad status: ${hackpad.ready ? 'ready' : 'not ready'}`) const mkdir = promisify(fs.mkdir) await mkdir("/bin", {mode: 0o700}) - await goWasm.overlayIndexedDB('/bin', {cache: true}) - await goWasm.overlayIndexedDB('/home/me') + await hackpad.overlayIndexedDB('/bin', {cache: true}) + await hackpad.overlayIndexedDB('/home/me') await mkdir("/home/me/.cache", {recursive: true, mode: 0o700}) - await goWasm.overlayIndexedDB('/home/me/.cache', {cache: true}) + await hackpad.overlayIndexedDB('/home/me/.cache', {cache: true}) await mkdir("/usr/local/go", {recursive: true, mode: 0o700}) - await goWasm.overlayTarGzip('/usr/local/go', 'wasm/go.tar.gz', { + await hackpad.overlayTarGzip('/usr/local/go', 'wasm/go.tar.gz', { persist: true, skipCacheDirs: [ '/usr/local/go/bin/js_wasm', @@ -44,11 +44,11 @@ async function init() { console.debug("Startup took", (new Date().getTime() - startTime) / 1000, "seconds") } -const initOnce = init(); // always wait on this to ensure goWasm window object is ready +const initOnce = init(); // always wait on this to ensure hackpad window object is ready export async function install(name) { await initOnce - return window.goWasm.install(name) + return window.hackpad.install(name) } export async function run(name, ...args) { @@ -85,8 +85,8 @@ export async function spawn({ name, args, ...options }) { export async function spawnTerminal(term, options) { await initOnce - const { goWasm } = window - return goWasm.spawnTerminal(term, options) + const { hackpad } = window + return hackpad.spawnTerminal(term, options) } export async function mkdirAll(path) {