初步编写网络接口相关类
This commit is contained in:
12
src/api/ApiManager.ts
Normal file
12
src/api/ApiManager.ts
Normal 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
12
src/api/BaseApi.ts
Normal 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) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user