Browse Source

Update index.js

xiaoyang0346 1 week ago
parent
commit
246f76fad3
1 changed files with 13 additions and 3 deletions
  1. 13 3
      index.js

+ 13 - 3
index.js

@@ -276,9 +276,6 @@ function exeExcelConfig() {
 	});
 
 	let pro = '';
-	if (hang == 4) {
-		pro += 'import { CTX } from "../src/util/master";\n';
-	}
 
 	pro += `export default class ConfProxy<T> {
     static getKey(args: string[]): string {
@@ -306,6 +303,19 @@ function exeExcelConfig() {
         });
     }
     
+	deepFreeze<T>(obj: T): T {
+        Object.freeze(obj);
+        Object.getOwnPropertyNames(obj).forEach(prop => {
+          const value = (obj as Record<string, any>)[prop];
+          if (value !== null 
+                && (typeof value === "object" || typeof value === "function") 
+                && !Object.isFrozen(value)) {
+            this.deepFreeze(value);
+          }
+        });
+        return obj as T;
+    }
+
     getItem(...args: string[]): T | null {
 		return this.pool[ConfProxy.getKey(args)]
     }`;