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

createRollSoundfunction

The tray's sound for one window. load fetches the recordings; it is the package's own lazy import unless a test hands in another.

Import it

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

Definition

function createRollSound(win: AudioWindow | undefined, load?: () => Promise<{ SOUNDS: SoundData; }>): RollSound

Parameters

NameTypeDescription
winAudioWindow | undefined

An audio-capable window, or undefined for a silent host.

load (optional)() => Promise<{ SOUNDS: SoundData; }>

A lazy loader for the recorded sounds.

Returns

RollSound

The tray's sound for one window. load fetches the recordings; it is the package's own lazy import unless a test hands in another.

Examples

import { createRollSound } from "@johnmorrisdotca/korokoro";
const sound = createRollSound(undefined);
sound.play({ dice: 2, ms: 0, landings: [0, 0] });
sound.close();
console.log(typeof sound.play);
function

What it prints (run when this page was built)

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