mountDie関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Put one die in an element. Only the element is needed: a die of 6 sides that rolls.
インポート
import { mountDie } from "@johnmorrisdotca/korokoro";
定義
function mountDie(target: HTMLElement, options?: DieOptions): DieHandle
引数
| 名前 | 型 | 説明 |
|---|---|---|
target | HTMLElement | The HTMLElement that owns the native interface. |
options (省略可) | DieOptions | Native settings and callbacks for this mounted interface. |
戻り値
DieHandle
The native mounted handle, including controls and destroy() cleanup.
例
import { mountDie } from "@johnmorrisdotca/korokoro";
const box = document.createElement("div");
document.body.append(box);
const die = mountDie(box, { sides: 20, size: "large", onRoll: (face) => console.log(face) });
die.roll();この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。