UNPKG

@selldone/sdk-storefront

Version:

A TypeScript SDK to connect to your shop and build a fully functional storefront and website by simply developing a frontend web application. All backend operations are seamlessly managed by the serverless Selldone solution.

41 lines (40 loc) 1.52 kB
/** * SoundHelper class provides methods to play sound effects asynchronously. * The sounds are only loaded when needed, optimizing resource usage. */ export declare class SoundHelper { /** * Audio element for the "tick" sound. * Loaded only when `playTick` is called for the first time. */ private static tick; /** * Audio element for the "win" sound. * Loaded only when `playWin` is called for the first time. */ private static win; private static bubble; private static double_bubble; /** * Loads a sound asynchronously and returns an HTMLAudioElement. * @param filePath - The path to the sound file to be loaded. * @returns A promise that resolves to the loaded HTMLAudioElement. */ private static loadSound; /** * Plays the "tick" sound. * If the sound hasn't been loaded yet, it loads asynchronously before playing. * The sound is stopped and rewound if it's already playing. * @param volume - Optional volume level for the sound (0.0 to 1.0). * @returns A promise that resolves when the sound starts playing. */ static playTick(volume?: number): Promise<void>; /** * Plays the "win" sound. * If the sound hasn't been loaded yet, it loads asynchronously before playing. * @returns A promise that resolves when the sound starts playing. */ static playWin(): Promise<void>; static playBubble(): Promise<void>; static playDoubleBubble(): Promise<void>; }