diff options
Diffstat (limited to 'api/base.ts')
-rw-r--r-- | api/base.ts | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/api/base.ts b/api/base.ts index e89e76b..28940ef 100644 --- a/api/base.ts +++ b/api/base.ts @@ -1,18 +1,12 @@ -import Core from "../core/api.ts"; import Yomikun from "./yomikun.ts"; /** @summary generic class that keeps a reference to parent API reference */ export default abstract class APIBase { private _resolveAPI: (api: Yomikun) => void = _ => {}; - - protected api: Promise<Yomikun>; - - constructor() { - this.api = new Promise<Yomikun>(res => this._resolveAPI = res); - } + protected api = new Promise<Yomikun>(res => this._resolveAPI = res); /** @summary set API reference and return self (for use directly after constructor) */ - withParent(api: Yomikun) { + withAPI(api: Yomikun) { this._resolveAPI(api); return this; } |