From 83964b02b1eadec70c6d3560916c6280bedc449f Mon Sep 17 00:00:00 2001 From: Augustin Chan Date: Wed, 6 Dec 2023 18:03:29 +0800 Subject: [PATCH] Set browser false when navigator object is empty --- src/util/env.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/env.ts b/src/util/env.ts index 33861781..f28adbee 100644 --- a/src/util/env.ts +++ b/src/util/env.ts @@ -99,7 +99,7 @@ export class Env { set ImageData(val) { this.#imageData = val; globalThis.ImageData = val; } constructor() { - this.browser = typeof navigator !== 'undefined'; + this.browser = typeof navigator !== 'undefined' && Object.keys(navigator).length !== 0; this.node = (typeof process !== 'undefined') && (typeof process.versions !== 'undefined') && (typeof process.versions.node !== 'undefined'); this.tfjs = { version: tf.version['tfjs-core'] }; this.offscreen = typeof OffscreenCanvas !== 'undefined';