Notifications
All notification will be displayed in the top right corner of the screen.
How does it look like?
Default notification
You can show notifications with notify function in JavaScript.
import notify from "./vendor/pjutils/utils/notification"; const defaultNotifyButton = document.querySelector('#notify-default'); defaultNotifyButton.addEventListener('click', function () { notify('This is a default notification', 'Default');});
By default notification will be shown for 5 seconds. You can pass autoHideTimeout parameter to the notify function to change the duration.
If you want to show notification until user closes it, you can pass autoHide parameter as false.
notify('This is a default notification', 'Default', 'info', true, 10000); // change duration to 10 secondsnotify('This is a default notification', 'Default', 'info', false); // notification will not hide automatically
Notifications can be of different types. You can pass level parameter to the notify function. Available types are:
Success
Success notification
notify('This is a success notification', 'Success notification', 'success');
Info
Info notification
notify('This is an info notification', 'Info notification', 'info');
Warning
Warning notification
notify('This is a warning notification', 'Warning notification', 'warning');
Error
Error notification
notify('This is an error notification', 'Error notification', 'error');