Reference · Rules, tiles and records
loadTileWordsfunction
THE LIST, ONCE. In a browser (or its worker) it arrives as its own script, fetched by the dynamic import below the first time a Kumimoji needs it.
ONLY IN A BROWSER, AND SAID SO WHERE THE BUILD CAN SEE IT. The page's
components are drawn on the server too, and a dynamic import in them is a
copy of its target in every server function — two lists, 1.3 MB, which put
the site's grouped function over its size limit (functionSizeGate). The
build writes typeof window as a constant — "undefined" on the server,
"object" in a browser bundle, its worker included — so on the server the
branch, and the import with it, is gone before anything is traced. The
server reads the list through tileWordsModule.ts instead, which only the
server's own checks and the tests import.
Import it
import { loadTileWords } from "@johnmorrisdotca/kumimoji";
Definition
function loadTileWords(language?: KumimojiLanguage): Promise<TileWords>
Parameters
| Name | Type | Description |
|---|---|---|
language (optional) | KumimojiLanguage | The English or Japanese tile language. |
Returns
Promise<TileWords>
THE LIST, ONCE. In a browser (or its worker) it arrives as its own script, fetched by the dynamic import below the first time a Kumimoji needs it.
Examples
import { loadTileWords } from "@johnmorrisdotca/kumimoji";
import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
await loadTileWordsFromModule("english");
console.log((await loadTileWords("english")).allowed.size);110316What it prints (run when this page was built)