本文へ移動

Dominoドミノ

シード付きでドミノを配り、標準のルールとコンピューターでメキシカントレインを遊び、保存したゲームを再生します。

「ドミノ」は、英語の domino をそのまま日本語に取り入れた言葉です。 名前について(英語)

目次

リファレンス · 音の操作

TileSounds型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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

インポート

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

定義

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

メンバー

名前型説明
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.

例

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]
}

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/domino 1.1.4 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。