Thanks to visit codestin.com
Credit goes to github.com

Skip to content

0.14.3 Tray Error: Cannot read property 'menu' of undefined #4816

@mangaga

Description

@mangaga

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;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions