Skip to content

Commit e120cbb

Browse files
committed
fix: Fixed navigator.userAgent empty error and Close #60
1 parent 8526880 commit e120cbb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const userAgent = typeof navigator === "undefined" ? "" : navigator.userAgent.toLowerCase();
1+
const userAgent = (
2+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase()
3+
) || "";
24
const isElectronEnv = userAgent.includes(" electron/");
35

46
export default isElectronEnv;

0 commit comments

Comments
 (0)