diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-06-29 23:25:01 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-06-29 23:25:01 +0200 |
commit | cc5689eaf4f7cfa158e31107906434da9aed62bf (patch) | |
tree | f02bb5f0887a48de32b9b06b6500c158043f0c52 /core/raw | |
parent | ccd4760cc28082c2d7d9bbebd1a60fe7da65d121 (diff) |
WIP examples + change `.prepare()` to `await .ready`
Diffstat (limited to 'core/raw')
-rw-r--r-- | core/raw/api.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/raw/api.ts b/core/raw/api.ts index 2d29eed..06db022 100644 --- a/core/raw/api.ts +++ b/core/raw/api.ts @@ -5,6 +5,7 @@ import YomikunError from "../../util/error.ts"; /** @summary internal Yomikun API client (DO NOT USE DIRECTLY) */ export default class YomikunRAWAPI implements API { private _parser: Parser; + ready: Promise<void>; constructor() { if (this.constructor === YomikunRAWAPI) { @@ -12,16 +13,15 @@ export default class YomikunRAWAPI implements API { } this._parser = new Parser(); - } - async prepare() { - await Promise.all([ - this._parser.prepare(), - ]); - } + this.ready = new Promise(async resolve => { + await this._parser.ready; + resolve(); + }) + } async parseSentence(input: string) { - return this._parser.parse(input); + return await this._parser.parse(input); } }; |