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

TileSoundstype

A table's sounds: play one, mute and unmute, change the volume, close when the table goes.

Import it

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

Definition

type TileSounds = {
    play(kind: TileSoundKind, options?: PlayTileSoundOptions): void;
    load(): Promise<boolean>;
    readonly muted: boolean;
    setMuted(muted: boolean): void;
    volume: number;
    close(): void;
};

Members

NameTypeDescription
play(kind: TileSoundKind, options?: PlayTileSoundOptions): void

Play a sound, or several of one kind in a row; nothing while muted or closed.

load(): Promise<boolean>

Fetch and decode the recordings now, rather than at the first sound. True once they are ready; false where they cannot be had.

mutedboolean

Whether it is muted.

setMuted(muted: boolean): void

Mute or unmute. Muting stops nothing already playing; it only keeps anything new from starting.

volumenumber

How loud, from 0 to 1.

close(): void

Stop for good, and let the audio context go.

Examples

import type { TileSounds } from "@johnmorrisdotca/domino/tile-sounds";
import { createTileSounds } from "@johnmorrisdotca/domino/tile-sounds";

const value: TileSounds = createTileSounds({muted:true,window:null});
console.log(value);
{
  play: [Function: play],
  load: [AsyncFunction: load],
  muted: [Getter],
  setMuted: [Function: setMuted],
  volume: [Getter/Setter],
  close: [Function: close]
}

What it prints (run when this page was built)

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