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
| Name | Type | Description |
|---|---|---|
win | AudioWindow | 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);functionWhat it prints (run when this page was built)