Skip to content

Differences from Node.js / Browsers, and Missing APIs ​

Differences from Node / Browsers ​

Gox is an independent runtime implemented from scratch, not a subset of Node or the browser. The differences below are deliberate design trade-offs.

Language Level ​

ItemGox behavior
varSupported (since 0.8.0): function scope plus hoisting. Day-to-day code should still prefer let / const
import { x as y }Supported. x is the module’s export name, y is the local binding. Namespace imports (import * as ns) and default exports work as usual
DateNone. Use Temporal
IntlNone. Number and date formatting you write yourself
encodeURI / decodeURINone. Assemble one yourself with String methods when needed
btoa / atobNone. Use ArrayBuffer / TypedArray or fs.readBytesSync for binary

Compared with Node.js ​

ItemDescription
npm ecosystemNot compatible. No require, no node_modules resolution, no native C++ addons
Module systemES modules only (import / export); no CommonJS
Host module surfaceOnly fs / path / process / http / fetch. No stream / child_process / os / crypto / net
processOnly argv / env / platform / pid / cwd / chdir / exit
Event loopSingle-threaded VM with callbacks captured on Go goroutines and re-posted back; semantics are close, but process.nextTick / setImmediate are not exposed

Compared with Browsers ​

ItemDescription
DOMNo document / window / CSS. UIs use the homegrown gx/gfx element tree
Web APIsNo localStorage / XMLHttpRequest / WebSocket / Worker / Canvas2D / WebGL
PersistenceUse gx/storage (writes to the system app-data directory) instead of localStorage
NetworkingThe fetch API looks familiar but only implements the two read methods text() / json()
Drawing<canvas> offers 7 drawing primitives (rects / circles / lines / text); no paths, transforms, or gradient textures
requestAnimationFrameProvided by gx/gfx (implemented as a 16ms timer), not a global function

Platform Capability Differences ​

CapabilityWindowsLinux (X11)macOS
CLI scripts✅✅✅
GUI windows✅✅ (needs on-device verification)✅ (cocoa, since 0.6.0)
IME input✅❌✅
Clipboard✅❌ degraded (reads empty string / writes false)✅ (NSPasteboard)
Native dialogs✅❌ degraded (confirm returns true, openFile returns null)✅ (alert / confirm / openFile / saveFile)
Display enumeration / window-to-screen mapping✅Not verified on device✅
Fold postureReported via reportPostureReportedReported (no foldable hardware on macOS)

Missing APIs Cheat Sheet ​

Handy for quick checks when migrating from another runtime — the names below do not exist in Gox; calling them yields a ReferenceError.

CategoryMissing members
Date & timeDate, Intl
EncodingencodeURI, decodeURI, encodeURIComponent, decodeURIComponent, btoa, atob, TextEncoder, TextDecoder
Structured datastructuredClone, FormData, URL, URLSearchParams, Blob, File
NetworkingXMLHttpRequest, WebSocket, EventSource, Request, Response (constructors)
ConcurrencyWorker, SharedArrayBuffer, Atomics
Host objectsdocument, window, navigator, localStorage, sessionStorage, location
Node-specificrequire, module, exports, __dirname, Buffer, process.nextTick, setImmediate, queueMicrotask
Node modulesstream, child_process, os, crypto, net, events, util, url, querystring
Reactive (import required)batch, createContext, useContext, createStore (untrack exists — it's in gx/solid)
Builtin modulesgx/machine, gx/kit (the state machine is still a userland pattern; the six native-capability modules gx/device / gx/app / gx/geo / gx/media / gx/permission / gx/viewport landed on 2026-09-21, and gx/router / gx/screen landed in the same batch — none of these are gaps anymore)
Missing from modulesgx/gfx.alert, gx/gfx.confirm, gx/gfx.openFile, gx/gfx.saveFile, gx/view.each, gx/view.show (the former live in gx/dialog, the latter are element-level directives)

Want to check whether an API actually exists?

The most direct way is to ask the REPL: typeof someName — "undefined" means no. To list all exports of a module, use a namespace import + Object.keys: import * as s from "gx/solid"; Object.keys(s). For full implementation-level details, see the JavaScript Runtime API implementation tutorial.