Skip to the content

Jarajaraジャラジャラ

Draw mahjong tiles, arrange racks and stacked boards, and play seeded Awase alone or at a shared table.

Jarajara is the Japanese sound of mahjong tiles rattling together. 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/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

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/jarajara/tile-sounds";
import { createTileSounds } from "@johnmorrisdotca/jarajara/tile-sounds";

const value: TileSounds = createTileSounds({muted:true,window:null});
console.log(value.muted);
value.close();
true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jarajara 1.7.0.