93788e76e0
Refs #20442 Adds the basic notification and notification with custom image examples from electron-api-demos into runnable Fiddle examples. Gist links to Fiddles (same as code submitted in this PR): Basic Notification: https://gist.github.com/102945f83f559e7944797175d8fd8af4 Notification with image: https://gist.github.com/2688bf4bfc27ce02f5d74224828eb928 Co-Authored-By: Erick Zhao <erick@hotmail.ca>
14 lines
500 B
JavaScript
14 lines
500 B
JavaScript
const notification = {
|
|
title: 'Notification with image',
|
|
body: 'Short message plus a custom image',
|
|
icon: 'https://raw.githubusercontent.com/electron/electron-api-demos/v2.0.2/assets/img/programming.png'
|
|
}
|
|
const notificationButton = document.getElementById('advanced-noti')
|
|
|
|
notificationButton.addEventListener('click', () => {
|
|
const myNotification = new window.Notification(notification.title, notification)
|
|
|
|
myNotification.onclick = () => {
|
|
console.log('Notification clicked')
|
|
}
|
|
})
|