本文整理匯總了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));