Skip to the content

Korokoroコロコロ

Roll mixed dice or type notation, compare exact probabilities, keep a history and replay seeded rolls.

Korokoro describes something small rolling in Japanese. About the name

Contents

Reference · Rolls and exact odds

mountDiefunction

Put one die in an element. Only the element is needed: a die of 6 sides that rolls.

Import it

import { mountDie } from "@johnmorrisdotca/korokoro";

Definition

function mountDie(target: HTMLElement, options?: DieOptions): DieHandle

Parameters

NameTypeDescription
targetHTMLElement

The HTMLElement that owns the native interface.

options (optional)DieOptions

Native settings and callbacks for this mounted interface.

Returns

DieHandle

The native mounted handle, including controls and destroy() cleanup.

Examples

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();

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/korokoro 1.16.0.