when i want to use the tray on my web iframe occur this error, but it ok on nw0.12.3.
error message:
extensions::nw.Tray:146 Uncaught TypeError: Cannot read property 'menu' of undefined
error position :
Tray.prototype.defineGetter('menu', function() {
return privates(this).menu;
});
my code:
var menu = new nw.Menu({type: 'menubar'});
var openMenu = new nw.MenuItem({
label: "open",
click: function() {
nw.Window.get().focus();
}
});
var exitMenu = new nw.MenuItem({
label: "exit",
click: function() {
nw.Window.get().focus();
nw.Window.get().close();
}
});
menu.append(openMenu);
menu.append(new nw.MenuItem({
type: "separator"
}));
menu.append(exitMenu);
var tray = new nw.Tray({
title: 'Tray',
icon: './favicon.png',
tooltip: 'tray',
menu: menu
});
//tray.menu = menu;
//click事件
tray.on('click',
function() {
trayClick();
});
global.myAppTray = tray;
on my web iframe where error happened:
var tray = global.myAppTray ;
if (tray) {
tray.menu.items[2].click = myfunction;
when i want to use the tray on my web iframe occur this error, but it ok on nw0.12.3.
error message:
extensions::nw.Tray:146 Uncaught TypeError: Cannot read property 'menu' of undefined
error position :
Tray.prototype.defineGetter('menu', function() {
return privates(this).menu;
});
my code:
global.myAppTray = tray;
on my web iframe where error happened:
var tray = global.myAppTray ;
if (tray) {
tray.menu.items[2].click = myfunction;