From 382bfe27205d5ade172fa088fcab0b2e123838e4 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 10 Dec 2017 01:01:43 +1100 Subject: Use `typeof process === "undefined"` instead of WEB global This removes requirement to set global.WEB before requiring in node --- src/loadlib.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/loadlib.js') diff --git a/src/loadlib.js b/src/loadlib.js index dbd5c3c..ef39f4f 100644 --- a/src/loadlib.js +++ b/src/loadlib.js @@ -36,7 +36,7 @@ const AUXMARK = [1]; ** error string in the stack. */ let lsys_load; -if (WEB) { +if (typeof process === "undefined") { lsys_load = function(L, path, seeglb) { path = lua.to_uristring(path); let xhr = new XMLHttpRequest(); @@ -111,9 +111,7 @@ const noenv = function(L) { }; let readable; -// Only with Node -if (!WEB) { - +if (typeof process !== "undefined") { // Only with Node const fs = require('fs'); readable = function(filename) { @@ -189,7 +187,7 @@ const ll_loadlib = function(L) { }; let env; -if (WEB) { +if (typeof process === "undefined") { env = window; } else { env = process.env; -- cgit v1.2.3-54-g00ecf