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/jarajara/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
| Name | Type | Description |
|---|---|---|
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. |
muted | boolean | Whether it is muted. |
setMuted | (muted: boolean): void | Mute or unmute. Muting stops nothing already playing; it only keeps anything new from starting. |
volume | number | How loud, from 0 to 1. |
close | (): void | Stop for good, and let the audio context go. |
Examples
import type { TileSounds } from "@johnmorrisdotca/jarajara/tile-sounds";
import { createTileSounds } from "@johnmorrisdotca/jarajara/tile-sounds";
const value: TileSounds = createTileSounds({muted:true,window:null});
console.log(value.muted);
value.close();trueWhat it prints (run when this page was built)