RollerHandle型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What mountRoller hands back: the tray, driven from code.
インポート
import type { RollerHandle } from "@johnmorrisdotca/korokoro";
定義
type RollerHandle = {
roll(): void;
history(): readonly Roll[];
setSpec(spec: Partial<RollSpec>): void;
setLocale(locale: string): void;
setCloth(cloth: Cloth): void;
setOnePip(colour: "red" | "black"): void;
destroy(): void;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
roll | (): void | Throw the dice showing, as a tap on the felt does. |
history | (): readonly Roll[] | Every roll kept so far, oldest first. |
setSpec | (spec: Partial<RollSpec>): void | Change part of the dice, or all of them: a spec with its count, sides, bonus and keep all given, as |
setLocale | (locale: string): void | Change the tray's language: "ja…" for Japanese, anything else for English, with |
setCloth | (cloth: Cloth): void | Lay the felt in another cloth, at once, keeping every die and roll: "green", "blue", "red", "black" or "wood". |
setOnePip | (colour: "red" | "black"): void | Change the colour of a d6's one pip at once: "red" or "black". |
destroy | (): void | Take the tray out of the page and stop its timers and its sound. |
例
import type { RollerHandle } from "@johnmorrisdotca/korokoro";
import { mountRoller } from "@johnmorrisdotca/korokoro";
const value: RollerHandle = mountRoller(document.createElement("div"), { sound: false, storage: null });
console.log(value.history());この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。