if (Notification.permission === 'granted') { new Notification('Hello, world!'); } else if (Notification.permission !== 'denied') { Notification.requestPermission().then(permission => { if (permission === 'granted') { new Notification('Hello, world!'); } }); }This code checks if the user has granted permission for notifications. If permission is granted, a new notification is created with the message “Hello, world!”. If permission is not granted, the user is prompted for permission and a notification is only shown if permission is granted. The Notification API is part of the Web API standard and is included in modern web browsers. No package library is required to use it.