♻️ Refactor code

This commit is contained in:
2025-06-02 13:34:54 +08:00
parent 44f7baad10
commit a516b8973e
53 changed files with 1513 additions and 1094 deletions

View File

@@ -3,9 +3,11 @@
import * as ConfigService from "./configservice.js";
import * as DocumentService from "./documentservice.js";
import * as SystemService from "./systemservice.js";
export {
ConfigService,
DocumentService
DocumentService,
SystemService
};
export * from "./models.js";

View File

@@ -136,6 +136,73 @@ export enum EditType {
EditEqual = 2,
};
/**
* MemoryStats 内存统计信息
*/
export class MemoryStats {
/**
* 当前堆内存使用量(字节)
*/
"heapInUse": number;
/**
* 堆内存分配总量(字节)
*/
"heapAlloc": number;
/**
* 系统内存使用量(字节)
*/
"sys": number;
/**
* GC 次数
*/
"numGC": number;
/**
* GC 暂停时间(纳秒)
*/
"pauseTotalNs": number;
/**
* Goroutine 数量
*/
"numGoroutine": number;
/** Creates a new MemoryStats instance. */
constructor($$source: Partial<MemoryStats> = {}) {
if (!("heapInUse" in $$source)) {
this["heapInUse"] = 0;
}
if (!("heapAlloc" in $$source)) {
this["heapAlloc"] = 0;
}
if (!("sys" in $$source)) {
this["sys"] = 0;
}
if (!("numGC" in $$source)) {
this["numGC"] = 0;
}
if (!("pauseTotalNs" in $$source)) {
this["pauseTotalNs"] = 0;
}
if (!("numGoroutine" in $$source)) {
this["numGoroutine"] = 0;
}
Object.assign(this, $$source);
}
/**
* Creates a new MemoryStats instance from a string or object.
*/
static createFrom($$source: any = {}): MemoryStats {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new MemoryStats($$parsedSource as Partial<MemoryStats>);
}
}
// Private type creation functions
const $$createType0 = Edit.createFrom;
const $$createType1 = $Create.Array($$createType0);

View File

@@ -0,0 +1,46 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* SystemService 系统监控服务
* @module
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as $models from "./models.js";
/**
* FormatBytes 格式化字节数为人类可读的格式
*/
export function FormatBytes(bytes: number): Promise<string> & { cancel(): void } {
let $resultPromise = $Call.ByID(1368998019, bytes) as any;
return $resultPromise;
}
/**
* GetMemoryStats 获取当前内存统计信息
*/
export function GetMemoryStats(): Promise<$models.MemoryStats> & { cancel(): void } {
let $resultPromise = $Call.ByID(1678201009) as any;
let $typingPromise = $resultPromise.then(($result: any) => {
return $$createType0($result);
}) as any;
$typingPromise.cancel = $resultPromise.cancel.bind($resultPromise);
return $typingPromise;
}
/**
* TriggerGC 手动触发垃圾回收
*/
export function TriggerGC(): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(741882899) as any;
return $resultPromise;
}
// Private type creation functions
const $$createType0 = $models.MemoryStats.createFrom;