hokein / electron-sample-apps

Sample apps for Electron
Apache License 2.0
3.91k stars 934 forks source link

Notification is not defined #42

Closed naheller closed 7 years ago

naheller commented 7 years ago

Hello,

Where is this example is Notification defined? The only place I see Notifications being used is in window.js, but there is no definition therein.

When I attempt to call up an instance of Notification(new Notification('title', 'body');), I get the error message Notification is not defined.

How can I fix this issue? Your advice is appreciated!

hokein commented 7 years ago

The Notification used in window.js is a HTML5 API, it is a build-in API in browser. In other words, you need to call it in renderer process.

For using Notification API in main process, please use the notification module provided by electron (since v1.7.3 beta).

The document of Notification in the sample is kind of out-of-dated, patch are always welcome. :)