本文整理汇总了TypeScript中electron.remote.Menu类的典型用法代码示例。如果您正苦于以下问题:TypeScript remote.Menu类的具体用法?TypeScript remote.Menu怎么用?TypeScript remote.Menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了remote.Menu类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: showContextMenu
function showContextMenu(e) {
e.preventDefault();
const pid = parseInt(e.currentTarget.id);
if (pid && typeof pid === 'number') {
const menu = new remote.Menu();
menu.append(new remote.MenuItem({
label: localize('killProcess', "Kill Process"),
click() {
process.kill(pid, 'SIGTERM');
}
})
);
menu.append(new remote.MenuItem({
label: localize('forceKillProcess', "Force Kill Process"),
click() {
process.kill(pid, 'SIGKILL');
}
})
);
menu.popup(remote.getCurrentWindow());
}
}
示例2: constructor
constructor() {
var menu = remote.Menu.buildFromTemplate([{
label: 'Raja',
submenu: [
{
label: 'open',
click: function(){
dialog.showOpenDialog((cb) => {
})
}
},
{
label: 'opencustom',
click: function(){
ipcRenderer.send('open-custom');
let notification = new Notification('Customdialog', {
body: 'This is a custom window created by us'
})
}
}
]
}])
remote.Menu.setApplicationMenu(menu);
}
示例3: showContextMenu
function showContextMenu(e) {
e.preventDefault();
const menu = new remote.Menu();
const pid = parseInt(e.currentTarget.id);
if (pid && typeof pid === 'number') {
menu.append(new remote.MenuItem({
label: localize('killProcess', "Kill Process"),
click() {
process.kill(pid, 'SIGTERM');
}
}));
menu.append(new remote.MenuItem({
label: localize('forceKillProcess', "Force Kill Process"),
click() {
process.kill(pid, 'SIGKILL');
}
}));
menu.append(new remote.MenuItem({
type: 'separator'
}));
menu.append(new remote.MenuItem({
label: localize('copy', "Copy"),
click() {
const row = document.getElementById(pid.toString());
if (row) {
clipboard.writeText(row.innerText);
}
}
}));
menu.append(new remote.MenuItem({
label: localize('copyAll', "Copy All"),
click() {
const processList = document.getElementById('process-list');
if (processList) {
clipboard.writeText(processList.innerText);
}
}
}));
} else {
menu.append(new remote.MenuItem({
label: localize('copyAll', "Copy All"),
click() {
const processList = document.getElementById('process-list');
if (processList) {
clipboard.writeText(processList.innerText);
}
}
}));
}
menu.popup({ window: remote.getCurrentWindow() });
}
示例4: isInProgress
if (isKeybindingForEvent(event, KeyboardAction.cliHistoryPrevious)) {
prompt.setPreviousHistoryItem();
event.stopPropagation();
event.preventDefault();
return;
}
if (isKeybindingForEvent(event, KeyboardAction.cliHistoryNext)) {
prompt.setNextHistoryItem();
event.stopPropagation();
event.preventDefault();
return;
}
}
}
prompt.setPreviousKeyCode(event);
};
function isInProgress(job: JobComponent): boolean {
return job.props.job.status === Status.InProgress;
}
const app = remote.app;
const browserWindow = remote.BrowserWindow.getAllWindows()[0];
const template = buildMenuTemplate(app, browserWindow);
remote.Menu.setApplicationMenu(remote.Menu.buildFromTemplate(template));