/** * A utility class to manage browser notifications with sound and custom behavior. * Useful for triggering system notifications with optional sound, avatar icon, body truncation, and click actions. * * @class */ declare class TinyNotifications { #private; /** * Constructs a new instance of TinyNotifications. * * @param {Object} [settings={}] - Optional settings to initialize the notification manager. * @param {string|HTMLAudioElement|null} [settings.audio] - Path or URL to the audio file for notification sounds. * @param {string|null} [settings.defaultIcon] - Default icon URL to be used in notifications. * @param {number} [settings.bodyLimit=100] - Maximum number of characters allowed in the notification body. * @param {(this: Notification, evt: Event) => any} [settings.defaultOnClick] - Default function to execute when a notification is clicked. * @throws {TypeError} If any of the parameters are of an invalid type. */ constructor({ audio, defaultIcon, bodyLimit, defaultOnClick, }?: { audio?: string | HTMLAudioElement | null; defaultIcon?: string | null; bodyLimit?: number; defaultOnClick?: (this: Notification, evt: Event) => any; }); /** * Requests permission from the user to show notifications. * Updates the internal `#allowed` flag. * * @returns {Promise} Resolves to `true` if permission is granted, otherwise `false`. */ requestPerm(): Promise; /** * Checks if the Notification API is supported by the current browser. * * @returns {boolean} Returns `true` if notifications are supported, otherwise `false`. */ isCompatible(): boolean; /** * Sends a browser notification with the provided title and configuration. * Truncates the body if necessary and plays a sound if configured. * * @param {string} title - The title of the notification. * @param {NotificationOptions & { vibrate?: number[] }} [config={}] - Optional configuration for the notification. * @returns {Notification|null} The created `Notification` instance, or `null` if permission is not granted. * @throws {TypeError} If the title is not a string or config is not a valid object. */ send(title: string, config?: NotificationOptions & { vibrate?: number[]; }): Notification | null; /** * Whether the requestPerm() method was already called. * @returns {boolean} */ wasPermissionRequested(): boolean; /** * Returns the current permission status. * @returns {boolean} `true` if permission was granted, otherwise `false`. */ isAllowed(): boolean; /** * Gets the current notification audio. * @returns {HTMLAudioElement|null} The sound element, or `null` if not set. */ getAudio(): HTMLAudioElement | null; /** * Sets the audio element used for notification sounds. * @param {HTMLAudioElement|string|null} value - A valid `HTMLAudioElement` or `null` to disable sound. * @throws {TypeError} If the value is not an `HTMLAudioElement` or `null`. */ setAudio(value: HTMLAudioElement | string | null): void; /** * Gets the maximum length of the notification body text. * @returns {number} Number of characters allowed. */ getBodyLimit(): number; /** * Sets the maximum number of characters allowed in the notification body. * @param {number} value - A non-negative integer. * @throws {TypeError} If the value is not a valid non-negative number. */ setBodyLimit(value: number): void; /** * Gets the default avatar icon URL. * @returns {string|null} The URL string or `null`. */ getDefaultAvatar(): string | null; /** * Sets the default avatar icon URL. * @param {string|null} value - A string URL or `null` to disable default icon. * @throws {TypeError} If the value is not a string or `null`. */ setDefaultAvatar(value: string | null): void; /** * Gets the default click event handler for notifications. * @returns {(this: Notification, evt: Event) => any} The current click handler function. */ getDefaultOnClick(): (this: Notification, evt: Event) => any; /** * Sets the default click event handler for notifications. * @param {(this: Notification, evt: Event) => any} value - A function to handle the notification click event. * @throws {TypeError} If the value is not a function. */ setDefaultOnClick(value: (this: Notification, evt: Event) => any): void; } export default TinyNotifications; //# sourceMappingURL=TinyNotifications.d.mts.map