-
Notifications
You must be signed in to change notification settings - Fork 93
Notifications
The notifications module in DuckOS is responsible for displaying user notifications and maintaining a history of these notifications. Notifications serve to provide users with important information or alerts about system events. This documentation explains the structure of the notifications system and provides an overview of its functions.
-
notificationandnotifhistoryElements- The
notificationelement represents the main notification display area. - The
notifhistoryelement is a container for storing a history of past notifications.
- The
-
notificationClickFunction-
notificationClickFunctionis a variable that holds the function to be executed when the user clicks on a notification.
-
-
hideTimeout-
hideTimeoutis a variable that stores the timeout for hiding a notification after a certain duration.
-
-
showNotification(title, message, clickFunction)- Displays a notification with the specified title and message.
- Optionally takes a
clickFunctionparameter, which is executed when the user clicks on the notification. - Adds the notification to the history.
-
hideNotification(event)- Hides the currently displayed notification with a sliding animation.
- Optionally takes an
eventparameter to stop event propagation.
-
executeNotificationFunction()- Executes the stored notification click function.
-
clearHideTimeout()- Clears the timeout set for hiding the notification.
-
setHideTimeout()- Sets a timeout for hiding the notification after a predefined duration (default is 3000 milliseconds).
Notifications are added to the notifhistory element, creating a record of past notifications. Each history item includes the title, message, and a "Remove" button for user interaction.
The provided code includes an example of displaying a notification after a certain delay.
Developers can use the showNotification function to display custom notifications throughout the application.
// Example usage:
setTimeout(function() {
showNotification("Welcome to DuckOS v6", "Feel free to explore the latest UI and all the exciting new features!");
}, 4500);The notifications module enhances user interaction by providing real-time feedback and important information. Developers can customize notifications and use them to inform users about system events, updates, or any other relevant information. The notification history feature allows users to review past notifications for reference.