javascript - Electron : Menu redirect to component (with Angular 4) -
this first project angular 4 , electron desktop application.
i have override electron menu don't know how redirect component when click on submenu item.
this part of menu.
const template = [ { label: 'options', submenu: [ {label: 'login', click(){gotoacomponent();}}, {label: 'quitter', 'role': 'quit'} ] }];
can me ?
in electron click handler send event:
const template = [ { label: 'options', submenu: [ {label: 'login', click(){ mainwindow.webcontents.send('customevent', customarg); } }, {label: 'quitter', 'role': 'quit'} ] }];
and in angular controller, listen event:
var ipc = require('electron').ipcrenderer; ipc.on('customevent', function(sender, customarg) { invokeyouractionhere(); });
Comments
Post a Comment