添加 assets_data

This commit is contained in:
shenjack-5600u 2024-04-01 22:44:47 +08:00
parent feabc1f394
commit 6036e44aee
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F

View File

@ -2,8 +2,9 @@
// let window = window; // let window = window;
let name_input = "test\ntest2"; let name_input = "test\ntest2";
let assets_data;
let from_node = typeof window == "undefined"; let from_node = typeof window == "undefined";
if (from_node) { if (from_node) {
console.log("Running from node"); console.log("Running from node");
@ -32,6 +33,24 @@ if (from_node) {
], ],
}; };
self = window; self = window;
// 读取文件
let fs = require("fs");
let path = require("path");
let assets_path = path.join(__dirname, "assets");
// 加载 zh.json
let lang_path = path.join(assets_path, "zh.json");
let lang_data = fs.readFileSync(lang_path, "utf-8");
// 加载 gAd.md
let gAd_path = path.join(assets_path, "gAd.md");
let gAd_data = fs.readFileSync(gAd_path, "utf-8");
assets_data = {
"lang": lang_data,
"gAd": gAd_data,
}
} }
let why_ns = 0; let why_ns = 0;