1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-09-02 02:48:03 +00:00

bootprefix: Tighten browser check to include the document global (#8423)

Deno's node emulation can run TiddlyWiki now that it supports the VM isolates API, but the window global exists in that environment, so both browser and node were being detected, causing the autoboot to trip up on nonexistent argv, as the boot was happening in the constructor right before argv was set.

Ref: https://github.com/denoland/deno/issues/19286
Ref: https://github.com/flexdinesh/browser-or-node
This commit is contained in:
Val Packett
2024-07-26 04:54:02 -03:00
committed by GitHub
parent 9069992163
commit 886514aa52

View File

@@ -21,7 +21,7 @@ $tw.boot = $tw.boot || Object.create(null);
// Detect platforms
if(!("browser" in $tw)) {
$tw.browser = typeof(window) !== "undefined" ? {} : null;
$tw.browser = typeof(window) !== "undefined" && typeof(document) !== "undefined" ? {} : null;
}
if(!("node" in $tw)) {
$tw.node = typeof(process) === "object" ? {} : null;