WorkerNavigator
Elide implements the [WinterCG Minimum Common API][wintercg]'s navigator surface — the
[WorkerNavigator][spec] interface together with its four mixin contracts (NavigatorID,
NavigatorLanguage, NavigatorOnLine, NavigatorConcurrentHardware). A single immutable
instance is exposed at globalThis.navigator and satisfies [SameObject] across reads.
[wintercg]: https://min-common-api.proposal.wintercg.org/ [spec]: https://html.spec.whatwg.org/#workernavigator
Construction
WorkerNavigator is not constructible from JavaScript — both new WorkerNavigator() and
plain-call WorkerNavigator() raise TypeError. The singleton is built once per realm during
runtime initialisation and bound as a data property on globalThis.
Attributes
All attributes are readonly. Each value is computed once at runtime initialisation and never changes for the life of the realm.| Attribute | Type | Value |
|---|---|---|
appCodeName | string | "Mozilla" (spec-mandated constant) |
appName | string | "Netscape" (spec-mandated constant) |
product | string | "Gecko" (spec-mandated constant) |
appVersion | string | 5.0 ( |
userAgent | string | Mozilla/5.0 Elide/ |
platform | string | One of linux, darwin, win32, freebsd, openbsd, sunos, derived from os.name; unknown for unrecognised systems |
language | string | Canonical BCP-47 form of the JVM default locale (e.g. en-US); falls back to en-US if the JVM reports an empty tag |
languages | FrozenArray | Frozen one-element array [language]. [SameObject] — identical reference on every read |
onLine | boolean | true (HTML spec default for non-browser environments — Elide does not surface live network-state detection) |
hardwareConcurrency | number | Runtime.getRuntime().availableProcessors(), never less than 1 |
appVersion and userAgent (x64 / arm64 / ia32) mirrors the
mapping used by process.arch, so values stay consistent across the Elide globals.
Notes on the implementation
languagesis built as a frozenArray(Object.freeze) at navigator-creation time. The array is cached on the instance so every read returns the same reference, in line with the spec's[SameObject]annotation. Mutation attempts on the array (languages[0] = ...,languages.push(...)) silently fail in sloppy mode and throwTypeErrorin strict mode.onLineis currently a statictrue. The HTML spec describes it as "the user agent's online state" — there is no portable cross-platform mechanism to surface that from a JVM process, andtrueis the documented default for environments that cannot answer the question.- The interface is exposed via
globalThis.navigator, and theWorkerNavigatorconstructor is also installed as a global (globalThis.WorkerNavigator), so it is available forinstanceofchecks. It is not constructible, however —new WorkerNavigator()throws (see above).