feat(wip): 進一步完善 UserAPI 和基類函數

This commit is contained in:
CrescentLeaf
2025-09-06 14:34:14 +08:00
parent adbe6b193b
commit e50a90a770
3 changed files with 8 additions and 2 deletions

View File

@@ -8,6 +8,12 @@ export default abstract class BaseApi {
this.onInit()
}
abstract onInit(): void
checkArgsMissing(args: {}, names: []) {
for (const k of names)
if (!(k in args))
return true
return false
}
registerEvent(name: CallMethod, func: EventCallbackFunction) {
if (!name.startsWith(this.getName() + ".")) throw Error("注冊的事件應該與接口集合命名空間相匹配: " + name)
ApiManager.addEventListener(name, func)