本文整理匯總了TypeScript中electron.remote.Menu.buildFromTemplate方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript remote.Menu.buildFromTemplate方法的具體用法?TypeScript remote.Menu.buildFromTemplate怎麽用?TypeScript remote.Menu.buildFromTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.remote.Menu
的用法示例。
在下文中一共展示了remote.Menu.buildFromTemplate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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);
}
示例2: 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));