2020-03-20 20:28:31 +00:00
|
|
|
const { app, Menu } = require('electron');
|
2019-01-15 20:35:53 +00:00
|
|
|
|
|
|
|
function output (value) {
|
2020-03-20 20:28:31 +00:00
|
|
|
process.stdout.write(JSON.stringify(value));
|
|
|
|
process.stdout.end();
|
2019-01-15 20:35:53 +00:00
|
|
|
|
2020-03-20 20:28:31 +00:00
|
|
|
app.quit();
|
2019-01-15 20:35:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2020-03-20 20:28:31 +00:00
|
|
|
let expectedMenu;
|
2019-01-15 20:35:53 +00:00
|
|
|
|
|
|
|
if (app.commandLine.hasSwitch('custom-menu')) {
|
2020-03-20 20:28:31 +00:00
|
|
|
expectedMenu = new Menu();
|
|
|
|
Menu.setApplicationMenu(expectedMenu);
|
2019-01-15 20:35:53 +00:00
|
|
|
} else if (app.commandLine.hasSwitch('null-menu')) {
|
2020-03-20 20:28:31 +00:00
|
|
|
expectedMenu = null;
|
|
|
|
Menu.setApplicationMenu(null);
|
2019-01-15 20:35:53 +00:00
|
|
|
}
|
|
|
|
|
2020-02-03 22:43:22 +00:00
|
|
|
app.whenReady().then(() => {
|
2019-01-15 20:35:53 +00:00
|
|
|
setImmediate(() => {
|
|
|
|
try {
|
2020-03-20 20:28:31 +00:00
|
|
|
output(Menu.getApplicationMenu() === expectedMenu);
|
2019-01-15 20:35:53 +00:00
|
|
|
} catch (error) {
|
2020-03-20 20:28:31 +00:00
|
|
|
output(null);
|
2019-01-15 20:35:53 +00:00
|
|
|
}
|
2020-03-20 20:28:31 +00:00
|
|
|
});
|
|
|
|
});
|
2019-01-15 20:35:53 +00:00
|
|
|
} catch (error) {
|
2020-03-20 20:28:31 +00:00
|
|
|
output(null);
|
2019-01-15 20:35:53 +00:00
|
|
|
}
|