aboutsummaryrefslogtreecommitdiff
path: root/api/yomikun.ts
blob: a7f214e179e75760417c4ef37179b2f67787c128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import Core from "../core/api.ts";
import RemoteCoreClient from "../core/http/client.ts";
import { ParseResult } from "../language/types.ts";
import Sentence from "./sentence.ts";

export default class Yomikun {
	protected core: Core;
	public ready: Promise<void>;

	constructor(core?: Core) {
		this.core = core ?? new RemoteCoreClient();

		this.ready = new Promise(async resolve => {
			await this.core.ready;
			resolve();
		})
	}

	async sentence(input: string): Promise<Sentence> {
    var sentence = new Sentence(input).withParent(this);
		await sentence.ready;
		return sentence;
	}
}