检测运行环境

This commit is contained in:
shenjack-5600u 2024-04-02 20:25:48 +08:00
parent d854be84f4
commit 6f40082f48
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F

View File

@ -1,7 +1,8 @@
// let document = document;
// let window = window;
'use strict';
// 'use strict';
// 兼容nodejs, 要不然 window = {}; 会崩
let name_input = "test\ntest2";
let assets_data = {
@ -10,9 +11,13 @@ let assets_data = {
};
let run_env = {
from_code: (typeof window == "undefined"),
is_node: (typeof Bun == "undefined"),
is_bun: (typeof Bun != "undefined"),
};
console.log("run_env", run_env);
let from_code = typeof window == "undefined";