blob: 28940ef8f3e4c796ad79eb4412108b3b75b22e9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
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 = new Promise<Yomikun>(res => this._resolveAPI = res);
/** @summary set API reference and return self (for use directly after constructor) */
withAPI(api: Yomikun) {
this._resolveAPI(api);
return this;
}
}
|