Akashdeep Saluja
Akashdeep Saluja

Reputation: 3089

Electron: Notification is not a constructor

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?

Upvotes: 5

Views: 3592

Answers (1)

kostyawh
kostyawh

Reputation: 123

I think you should write

new electron.remote.Notification({....})

instead of

new electron.Notification({....})

Upvotes: 8

Related Questions