UNPKG

tiny-essentials

Version:

Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.

47 lines 2.04 kB
export default TinyHtmlAudio; /** * TinyHtmlAudio is a helper class for managing <audio> elements. * It provides full support for standard audio attributes such as * `src`, `preload`, `controls`, `autoplay`, `loop`, `muted`, and `volume`, * using validated getters and setters for consistency. * * @example * const audio = new TinyHtmlAudio({ * src: 'music.mp3', * controls: true, * autoplay: false, * loop: true, * volume: 0.8 * }); * * @extends TinyHtmlMedia<HTMLAudioElement> */ declare class TinyHtmlAudio extends TinyHtmlMedia<HTMLAudioElement> { /** * Creates a new TinyHtmlAudio instance. * @param {Object} config - Configuration object. * @param {string} [config.src=""] - Audio source URL. * @param {'auto'|'metadata'|'none'} [config.preload] - Preload behavior. * @param {boolean} [config.controls=false] - Whether playback controls are displayed. * @param {boolean} [config.autoplay=false] - Whether playback starts automatically. * @param {boolean} [config.loop=false] - Whether playback should loop. * @param {boolean} [config.muted=false] - Whether the audio starts muted. * @param {number} [config.volume] - Initial playback volume (0.0 to 1.0). * @param {string|string[]|Set<string>} [config.tags=[]] - Initial CSS classes. * @param {string} [config.mainClass=""] - Main CSS class. * @throws {TypeError} If any attribute is of the wrong type. */ constructor({ src, preload, controls, autoplay, loop, muted, volume, tags, mainClass, }?: { src?: string | undefined; preload?: "auto" | "none" | "metadata" | undefined; controls?: boolean | undefined; autoplay?: boolean | undefined; loop?: boolean | undefined; muted?: boolean | undefined; volume?: number | undefined; tags?: string | string[] | Set<string> | undefined; mainClass?: string | undefined; }); } import TinyHtmlMedia from '../TinyHtmlMedia.mjs'; //# sourceMappingURL=TinyHtmlAudio.d.mts.map