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; constructor() { this.api = new Promise(res => this._resolveAPI = res); } /** @summary set API reference and return self (for use directly after constructor) */ withParent(api: Yomikun) { this._resolveAPI(api); return this; } }