npm install hangul-ime
or
yarn add hangul-ime
const hangulIme = new HangulIme();
hangulIme.insert("ㄱ");
hangulIme.insert("ㅏ");
hangulIme.insert("ㄱ");
hangulIme.insert("ㅅ");
console.log(hangulIme.composingSyllable); // result: 값
const hangulIme = new HangulIme();
hangulIme.insert("ㄱ");
hangulIme.insert("ㅏ");
hangulIme.insert("ㄱ");
hangulIme.insert("ㅅ");
hangulIme.insert("ㅏ");
console.log(hangulIme.completedSyllable); // result: 각
console.log(hangulIme.composingSyllable); // result: 사
const hangulIme = new HangulIme();
let actualCompletedSyllable = "";
let actualComposingSyllable = "";
const onComplete = (completedSyllable: string, composingSyllable: string) => {
actualCompletedSyllable = completedSyllable;
actualComposingSyllable = composingSyllable;
};
const onCompose = (composingSyllable: string) => {
actualComposingSyllable = composingSyllable;
}
hangulIme.insert("ㄱ").onComplete(onComplete).onCompose(onCompose);
hangulIme.insert("ㅏ").onComplete(onComplete).onCompose(onCompose);
hangulIme.insert("ㄱ").onComplete(onComplete).onCompose(onCompose);
hangulIme.insert("ㅅ").onComplete(onComplete).onCompose(onCompose);
hangulIme.insert("ㅏ").onComplete(onComplete).onCompose(onCompose);
console.log(actualCompletedSyllable); // result: 각
console.log(actualComposingSyllable); // result: 사
const hangulIme = new HangulIme();
let actualCompletedSyllable = "";
let actualComposingSyllable = "";
hangulIme.insert("ㄱ");
hangulIme.insert("ㅏ");
hangulIme.insert("ㄱ");
hangulIme.insert("ㅅ");
hangulIme.insert("ㅏ");
if (hangulIme.step === "completed") {
actualCompletedSyllable = hangulIme.latestCompletedSyllable;
actualComposingSyllable = hangulIme.composingSyllable;
}
console.log(actualCompletedSyllable); // result: 각
console.log(actualComposingSyllable); // result: 사
- MS Windows 한글 IME 입력 방법을 따른다.
- 자음, 모음을 통칭한다.
ex) ㄱ, ㄴ, ㄷ, ㅏ, ㅑ, ㅓ, ㅕ
- 자음, 모음의 조합이다.
ex) 가, 나, 값, ㅘ, ㄳ
자음, 모음, 완성형 글자 등의 글자