A MenuItemConstructorOptions
that creates a menu item, which opens the given URL in the browser when clicked.
import {Menu} from 'electron';
import {openUrlMenuItem} from 'electron-util';
const menu = Menu.buildFromTemplate([
{
label: 'Help',
submenu: [
openUrlMenuItem({
label: 'Website',
url: 'https://sindresorhus.com'
})
]
}
]);
Menu.setApplicationMenu(menu);
Accepts the same options as
new MenuItem()
in addition to aurl
option. If you specify theclick
option, its handler will be called before the URL is opened.