Skip to main content

Crate inputx_nihongo_wasm

Crate inputx_nihongo_wasm 

Source
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 --release

Usage (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§

JapaneseEngine
JP engine wrapping the embedded romaji / jukugo / kanji tables. Cheap to construct (all data is in const tables).

Enums§

KanaKind
Kana kind mirrored for JS. Use as KanaKind.Kanji etc. Numeric values match the facade enum’s discriminants.