本文整理匯總了TypeScript中electron.BrowserWindow.setMenu方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserWindow.setMenu方法的具體用法?TypeScript BrowserWindow.setMenu怎麽用?TypeScript BrowserWindow.setMenu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.setMenu方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise(resolve => {
if (isDev || !isAnySetupRequired()) {
const {
loadExtensions
} = require("eez-studio-shared/extensions/extensions") as typeof ExtensionsModule;
loadExtensions();
resolve();
return;
}
let win = new BrowserWindow({
width: 600,
height: 200,
backgroundColor: "#333",
show: false
});
win.setMenu(null);
win.loadURL(`file://${__dirname}/../setup/setup.html`);
win.show();
ipcMain.on("startSetup", async (event: Event) => {
await doSetup(event.sender);
win.close();
resolve();
});
});
示例2: getCurrentSchedule
getCurrentSchedule((schedule) => {
let posterWindow = new BrowserWindow({width: 795, height: 800, show: debug});
if (debug) {
posterWindow.webContents.openDevTools();
}
posterWindow.setMenu(null);
posterWindow.loadURL(`file://${__dirname}/poster.html`);
ipcMain.once('+main:poster-angular-up', () => {
if (debug) {
posterWindow.webContents.send('+view:debug-enabled');
}
posterWindow.webContents.send('+view:open-schedule', schedule, month);
});
ipcMain.once('+main:poster-ready', () => {
posterWindow.webContents['_printToPDF'](posterPrintingSetting, (err, data) => {
if (err) throw err;
fs.writeFile(filename, data, (err) => {
if (err) throw err;
console.log('Write PDF successfully.');
dialog.showMessageBox({
type: 'info',
title: 'PDF Saved',
message: 'Poster rendered and saved to file.',
buttons: ['OK'],
});
if (!debug) {
posterWindow.close();
}
});
});
});
});
示例3: createWindow
function createWindow() {
const electronScreen = screen;
const size = electronScreen.getPrimaryDisplay().workAreaSize;
// Create the browser window.
win = new BrowserWindow({
x: 0,
y: 0,
width: 295,
height: 315,
resizable: false,
icon: __dirname + '/favicon.jpg'
// width: size.width,
// height: size.height
});
win.setMenu(null);
win.setAlwaysOnTop(true, "floating", 1);
// and load the index.html of the app.
win.loadURL('file://' + __dirname + '/index.html');
// Open the DevTools.
if (serve) {
win.webContents.openDevTools();
}
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store window
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}
示例4: createWindow
function createWindow() {
mainWindow = new BrowserWindow({height: 650, width: 900, show: debug});
if (debug) {
mainWindow.webContents.openDevTools();
}
mainWindow.loadURL(`file://${__dirname}/index.html`);
if (process.platform === 'darwin') {
Menu.setApplicationMenu(createMenu());
} else {
mainWindow.setMenu(createMenu());
}
ipcMain.once('+main:angular-up', () => {
if (debug) {
mainWindow.webContents.send('+view:debug-enabled');
}
if (startFile) {
openScheduleFromFile(startFile);
}
mainWindow.show();
});
ipcMain.on('+main:new-schedule', () => {
createNewSchedule();
});
ipcMain.on('+main:open-schedule', () => {
openScheduleFileDialog();
});
mainWindow.on('closed', () => {
mainWindow = null;
app.quit();
});
};
示例5: BrowserWindow
app.on('ready', () => {
mainWindow = new BrowserWindow({
height: 600,
width: 800,
minWidth: 600,
minHeight: 400,
backgroundColor: '#000'
});
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.setMenu(null);
// open external (target="_blank") links in browser.
mainWindow.webContents.on('new-window', (e, url) => {
e.preventDefault();
shell.openExternal(url);
});
mainWindow.webContents.on('devtools-opened', () => {
mainWindow.webContents.send(OPEN_DEVTOOLS);
});
mainWindow.webContents.on('devtools-closed', () => {
mainWindow.webContents.send(CLOSE_DEVTOOLS);
});
mainWindow.on('close', () => {
sampleSubscription.unsubscribe();
if (remoteWindow && !remoteWindow.isDestroyed()) {
remoteWindow.close();
}
});
});
示例6: BrowserWindow
app.on('ready', () => {
mainWindow = new BrowserWindow({ width: 400, height: 400, frame: false })
mainWindow.loadURL(`file://${__dirname}/renderer/index.html`)
mainWindow.webContents.openDevTools() // TODO: only if debug mode
mainWindow.on('closed', (): void => mainWindow = null)
mainWindow.setMenu(null)
})
示例7: function
Electron.app.on('ready', function() {
mainWindow = new Electron.BrowserWindow({
width: 800,
height: 600,
minWidth: 300,
minHeight: 300
});
mainWindow.setMenu(null);
mainWindow.webContents.loadURL(`file://${__dirname}/client/index.html`);
mainWindow.on('close', function() {
mainWindow = null;
});
});
示例8: createWindow
function createWindow() {
win = new BrowserWindow({ width: 800, height: 600, show: false });
win.setMenu(null);
win.setMenuBarVisibility(false);
win.maximize();
win.loadURL("http://localhost:8080");
win.once('ready-to-show', () => {
win && win.show()
});
win.on("closed", () => {
win = null;
});
}
示例9: createWindow
function createWindow() {
'use strict';
let browserWindowOptions: Electron.BrowserWindowOptions = {
width: 1000,
height: 600,
webPreferences: {
plugins: true,
},
};
mainWindow = new electron.BrowserWindow(browserWindowOptions);
mainWindow.setMenu(null);
mainWindow.loadURL('file://' + __dirname + '/../browser/index.html');
// mainWindow.webContents.openDevTools();
mainWindow.on('closed', () => {
mainWindow = undefined;
});
}
示例10: async
const createWindow = async () => {
mainWindow = new BrowserWindow({
width: 800,
height: 600
});
mainWindow.setMenu(null);
mainWindow.loadURL(`file://${__dirname}/index.html`);
if (isDevMode) {
mainWindow.webContents.openDevTools();
}
mainWindow.on('closed', () => {
mainWindow = null;
});
};