I am trying to initialize an object of Notification provided by electron. But I am getting the error as:
Uncaught Exception:
TypeError: electron.Notification is not a constructor
I am doing this in Main
process.
Code:
const electron = require('electron');
new electron.Notification({ title: "Cue", body: "Hello" }).show();
Electron version: 2.0.2/2.0.3
Any clues or ideas?
I am trying to initialize an object of Notification provided by electron. But I am getting the error as:
Uncaught Exception:
TypeError: electron.Notification is not a constructor
I am doing this in Main
process.
Code:
const electron = require('electron');
new electron.Notification({ title: "Cue", body: "Hello" }).show();
Electron version: 2.0.2/2.0.3
Any clues or ideas?
Share Improve this question edited Jun 25, 2018 at 17:38 Akashdeep Saluja asked Jun 25, 2018 at 17:24 Akashdeep SalujaAkashdeep Saluja 3,0958 gold badges35 silver badges62 bronze badges 9-
have you tried
new Notification()
rather thannew electron.Notification()
? – phuzi Commented Jun 25, 2018 at 17:28 -
@phuzi yup gives me
not defined
. – Akashdeep Saluja Commented Jun 25, 2018 at 17:29 - which version of electron you're using? – OJ Kwon Commented Jun 25, 2018 at 17:30
- @OJKwon 2.0.2/2.0.3 – Akashdeep Saluja Commented Jun 25, 2018 at 17:38
-
try debugging your code. What is
electron.Notification
? Is itundefined
? – pushkin Commented Jun 25, 2018 at 17:52
1 Answer
Reset to default 8I think you should write
new electron.remote.Notification({....})
instead of
new electron.Notification({....})