Skip to the content

Dominoドミノ

Deal seeded dominoes, play Mexican Train with native rules and computers, and replay a saved game.

Domino is the Japanese borrowed word ドミノ for dominoes. About the name

Contents

Reference

Sound controls

import { … } from "@johnmorrisdotca/domino/tile-sounds";

19.3 kB minified and gzipped, with everything it imports (measured with esbuild)

THE SOUNDS OF A DOMINO TABLE: tiles shuffled, a tile drawn from the boneyard, a tile laid, a knock on the table for a pass. The recordings are poker chips set down and handled (Kenney's Casino Audio, CC0; see CREDITS.md), the nearest recorded sound of a hard tile on a table that is free to use. They are loaded the first time a sound is played and never before, so a page that stays silent never fetches them. Where they cannot be loaded or decoded, a short sound made in the browser stands in. Nothing here throws: a platform with no audio, a context the browser holds still, or a failed decode is simply silent.

Domino never makes a sound by itself. A table asks for one with play.

Exports

NameKindWhat it is
createTileSoundsfunctionA table's tile sounds.
MOST_SOUNDS_AT_ONCEconstantAs many sounds as one call plays: fifteen tiles drawn are eight clicks, not a wall of noise.
PlayTileSoundOptionstypeHow one sound is played.
soundTimesfunctionWhen each of count sounds starts, in milliseconds from the first: one every gap, and no more than MOST_SOUNDS_AT_ONCE, spread over the same time.
TILE_SOUND_KINDSconstantEvery kind of sound, in the order a game meets them.
TileSoundDatatypeThe recordings, by name (lay-2), as base64 AAC.
TileSoundKindtypeOne kind of sound: shuffle the tiles stirred face down, draw a tile taken from the boneyard, lay a tile set down on a train, knock a rap on the table, which is how a pass is announced.
TileSoundstypeA table's sounds: play one, mute and unmute, change the volume, close when the table goes.
TileSoundsOptionstypeHow a table's sounds are made.
TileSoundWindowtypeThe parts of a window the sounds use: an audio context and atob.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/domino 1.1.4.