Skip to the content

Hitotsu一つ

Match the colour or number, call with one card left, and play classic or party rules against computers or at a shared table.

Hitotsu is Japanese for one: the call with one card left. About the name

Contents

Reference · Card sounds

CardSoundstype

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

Import it

import type { CardSounds } from "@johnmorrisdotca/hitotsu/card-sounds";

Definition

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

Members

NameTypeDescription
play(kind: CardSoundKind, options?: PlayCardSoundOptions): 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 { CardSounds } from "@johnmorrisdotca/hitotsu/card-sounds";
import { createCardSounds } from "@johnmorrisdotca/hitotsu/card-sounds";

const value: CardSounds = createCardSounds({ muted: true, window: null });
console.log(value.muted);
true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hitotsu 1.4.0.