Transition型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The resulting native state, emitted events and acceptance decision; rejected actions preserve the input.
インポート
import type { Transition } from "@johnmorrisdotca/houseki/falling-triplets";
定義
interface Transition {
readonly state: GameState;
readonly events: readonly GameEvent[];
readonly accepted: boolean;
readonly reason?: string;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
state | GameState | |
events | readonly GameEvent[] | |
accepted | boolean | |
reason (省略可) | string | undefined |
例
import { applyAction, createGame } from "@johnmorrisdotca/houseki/falling-triplets";
import type { Action, Transition } from "@johnmorrisdotca/houseki/falling-triplets";
const state=createGame({seed:"docs"});
const action: Action={kind:"left"};
const value: Transition = applyAction(state,action);
console.log(value == null ? value : typeof value === "object" ? Object.keys(value).slice(0,6) : value);[ 'state', 'events', 'accepted' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。