KotobaPlayOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a round is dealt from, and how the game looks and behaves. Every field may be left out.
インポート
import type { KotobaPlayOptions } from "@johnmorrisdotca/kotoba/play";
定義
type KotobaPlayOptions = {
words?: WordListName;
size?: number;
easy?: boolean;
rows?: number;
seed?: number;
daily?: boolean | string;
hidden?: string;
locale?: Language;
strings?: Partial<KotobaStrings>;
theme?: Record<string, string>;
keyboard?: boolean;
keyboardTarget?: HTMLElement;
onFinish?: (game: WordGame) => void;
onChange?: (game: WordGame | null) => void;
load?: (words: WordListName, size: number) => Promise<LoadedWordList | null>;
now?: () => number;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
words (省略可) | WordListName | undefined | The list: English, French, German or Japanese kana. Unless said, English. |
size (省略可) | number | undefined | Letters, or kana, in the word. Unless said, five, or four kana. |
easy (省略可) | boolean | undefined | Hide only one of the easy answers. Unless said, any answer. |
rows (省略可) | number | undefined | How many guesses the round gives. Unless said, six. |
seed (省略可) | number | undefined | A seed: the same seed picks the same word from the same list. Unless said, one is drawn. |
daily (省略可) | string | boolean | undefined | The word of the day ( |
hidden (省略可) | string | undefined | The word to find, whatever the lists say: a friend's, or one from your own source. Wins over |
locale (省略可) | Language | undefined | The language of the game's own words: the prompts, the keys and the legend. Unless said, English. |
strings (省略可) | Partial<KotobaStrings> | undefined | Words of your own, over |
theme (省略可) | Record<string, string> | undefined | CSS variables set on the game: |
keyboard (省略可) | boolean | undefined | Take the device's keyboard (letters, Enter, Backspace) as the keys on the screen. Unless said, yes. |
keyboardTarget (省略可) | HTMLElement | undefined | Listen on this host instead of the document; embedded games use their own focused board. |
onFinish (省略可) | ((game: WordGame) => void) | undefined | Called once when a round ends, with the round: its guesses and its score. |
onChange (省略可) | ((game: WordGame | null) => void) | undefined | Called after every change of the round, and with null while a list is loading. |
load (省略可) | ((words: WordListName, size: number) => Promise<LoadedWordList | null>) | undefined | Where a list comes from. Unless said, |
now (省略可) | (() => number) | undefined | The time in milliseconds, for the clock a score reads. Unless said, |
例
import type { KotobaPlayOptions } from "@johnmorrisdotca/kotoba/play";
const optionsFor = (host: HTMLElement): KotobaPlayOptions => ({ keyboardTarget: host });
console.log(typeof optionsFor); // functionfunction出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。