Expand description
WASM bindings for inputx-nihongo. Exposes a JS-friendly
JapaneseEngine so browser / Node consumers can drive the
Japanese IME engine via wasm-pack output.
Build:
wasm-pack build crates/inputx-nihongo-wasm --target web --releaseUsage (JS):
import init, { JapaneseEngine, KanaKind } from "@goliapkg/nihongo";
await init();
const eng = new JapaneseEngine();
for (const c of "shinjuku") eng.handleLetter(c.charCodeAt(0));
console.log(eng.candidates());
// [
// { word: "新宿", kind: KanaKind.Kanji, freq: N,
// composed: false, proximityMilli: 1000 },
// { word: "しんじゅく", kind: KanaKind.Hiragana, freq: 0, ... },
// { word: "シンジュク", kind: KanaKind.Katakana, freq: 0, ... },
// ]
const committed = eng.commitIndex(0); // "新宿"Structs§
- Japanese
Engine - JP engine wrapping the embedded romaji / jukugo / kanji tables. Cheap to construct (all data is in const tables).
Enums§
- Kana
Kind - Kana kind mirrored for JS. Use as
KanaKind.Kanjietc. Numeric values match the facade enum’s discriminants.