初步编写网络接口相关类

This commit is contained in:
CrescentLeaf
2025-08-14 12:07:28 +08:00
parent 581a6acc52
commit 0000eeead2
2 changed files with 24 additions and 0 deletions

12
src/api/ApiManager.ts Normal file
View File

@@ -0,0 +1,12 @@
import BaseApi from './BaseApi.ts'
import HttpServerLike from '../types/HttpServerLike.ts'
export default class ApiManager {
declare httpServer: HttpServerLike
static init(httpServer: HttpServerLike) {
this.httpServer = httpServer
}
static getHttpServer() {
return this.httpServer
}
}

12
src/api/BaseApi.ts Normal file
View File

@@ -0,0 +1,12 @@
import UnknownFunction from '../types/UnknownFunction.ts'
export default abstract class BaseApi {
abstract getName(): string
constructor() {
this.init()
}
abstract init(): void
registerEvent(name: string, func: UnknownFunction) {
}
}