Notification doesn't show up


#1

I am new to electron and I wanted to create a Notification, so just simply used the documentations code, but it doesn’t work.
I imported the ‘Notification’ variable from electron, and this is my code:
app.on('activate', () => { new Notification('hello'); console.log('Hello') });
I would really appreciate if someone could help me to solve this issue.


#2

I don’t know anything about electron itself, but I suggest looking at the dev tools window when you run the app. You’ll find Hello logged there, just like you’ve told the program to do.

Specifically, console.log('Hello') is logging the string Hello. That is all. You need to assign a variable to the new notification, and read the docs here to understand how to display a proper notification. If you are instead using the HTML5 API, then I can’t say why the notification is not appearing.

BTW, if you are new to JavaScript, making an electron app is not what I would recommend as a first time project. Try making an Atom package instead, you can learn a lot that way and people here will be able to help you better. You don’t need to publish the package, so it can be as simple / complex / buggy as you like (or can tolerate).