Error while displayBalloon method on Tray


#1

Hi, I am trying to use displayBalloon method on Tray object but its giving me error of “Error: Could not call remote function ‘displayBalloon’. Check that the function signature is correct. Underlying error: ‘title’ and ‘content’ must be defined”.

However I have already defined these values. Please suggest what is wrong out here.

var remote = require('remote');
var Tray = remote.require('tray');
var Menu = remote.require('menu');
var path = require('path');

var trayIcon = null;
var image = new Tray(path.join(__dirname, 'Red.ico'));
var trayTitle ='New Message Notification';
var content = 'Message Content';

if (process.platform === 'darwin') {
    trayIcon = new Tray(path.join(__dirname, 'Red.ico'));
}
else {
    trayIcon = new Tray(path.join(__dirname, 'No.ico'));
}

var trayMenuTemplate = [
    {
        label: 'Settings',
        click: function () {
            ipc.send('open-settings-window');
        }
    },
    {
        label: 'Quit',
        click: function () {
            ipc.send('close-main-window');
        }
    }
];
var trayMenu = Menu.buildFromTemplate(trayMenuTemplate);
trayIcon.setContextMenu(trayMenu);
trayIcon.displayBalloon(image,trayTitle,content);

Regards,
Manoj