本文へ移動

Kumimoji組み文字

シードから配った英字やかなのタイルで、ひとりでも複数人の卓でも、単語を組み合わせて遊べます。

「組み文字」は文字を組み合わせることを表す言葉です。 名前について(英語)

目次

リファレンス · ルール・タイル・記録

loadTileWords関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { loadTileWords } from "@johnmorrisdotca/kumimoji";

定義

function loadTileWords(language?: KumimojiLanguage): Promise<TileWords>

引数

名前型説明
language (省略可)KumimojiLanguage

The English or Japanese tile language.

戻り値

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.

例

import { loadTileWords } from "@johnmorrisdotca/kumimoji";
import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";

await loadTileWordsFromModule("english");
console.log((await loadTileWords("english")).allowed.size);
110316

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/kumimoji 1.6.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。