Reference · Rolls and exact odds
mountRollerfunction
Put a dice tray into an element.
One model runs the whole tray: the roll is a pool of dice. Tapping a die
button adds one die of that kind to the pool; a chip in the pool takes one
away; the number row sets how many of the kind last touched. The dice the
tray opens with are a suggestion, not yet anybody's roll, so the first die
tapped takes their place: one tap gives a d20, and d20, d4, d4 gives
1d20+2d4. The notation box says the same pool in writing and can be typed
into for anything the buttons do not reach.
A tap on the felt throws the pool. Once plain dice have been thrown, a tap on a die holds it and the next throw rolls the rest.
Import it
import { mountRoller } from "@johnmorrisdotca/korokoro";
Definition
function mountRoller(target: HTMLElement, options?: RollerOptions): RollerHandle
Parameters
| Name | Type | Description |
|---|---|---|
target | HTMLElement | The HTMLElement that owns the native interface. |
options (optional) | RollerOptions | Native settings and callbacks for this mounted interface. |
Returns
RollerHandle
The native mounted handle, including controls and destroy() cleanup.
Examples
import { mountRoller } from "@johnmorrisdotca/korokoro";
const show = (host: HTMLElement, options: Parameters<typeof mountRoller>[1]) => mountRoller(host, options);
console.log(typeof show); // functionfunctionWhat it prints (run when this page was built)