本文整理汇总了TypeScript中electron.Tray.setTitle方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Tray.setTitle方法的具体用法?TypeScript Tray.setTitle怎么用?TypeScript Tray.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.Tray
的用法示例。
在下文中一共展示了Tray.setTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createWindow
// tslint:disable-next-line:only-arrow-functions
function createWindow() {
tray = new Tray(`${__dirname}/icon-menu-play.png`);
tray.setTitle('...');
/* const contextMenu = Menu.buildFromTemplate([
{ label: 'Item1', type: 'radio' },
{ label: 'Item2', type: 'radio' },
{ label: 'Item3', type: 'radio', checked: true },
{ label: 'Item4', type: 'radio' }
]);
tray.setToolTip('This is my application.');
tray.setContextMenu(contextMenu); */
const windowConfiguration = {
autoHideMenuBar: true,
// tslint:disable-next-line:no-magic-numbers
width: DEV_MODE ? 700 : 300,
// tslint:disable-next-line:no-magic-numbers
height: DEV_MODE ? 518 : 118,
};
if (process.platform === 'win32') {
// tslint:disable-next-line:no-magic-numbers
windowConfiguration.width *= 1.5;
// tslint:disable-next-line:no-magic-numbers
windowConfiguration.height *= 1.5;
}
// Create the browser window.
mainWindow = new BrowserWindow(windowConfiguration);
const mainUrl = process.env.MAIN_APP_URL || join('file://', __dirname, '/index.html');
console.log(`Loading: ${mainUrl}`);
mainWindow.loadURL(mainUrl);
if (DEV_MODE) {
console.log('Enable DevTools');
mainWindow.webContents.openDevTools({ detach: true });
}
// Open the DevTools.
// mainWindow.webContents.openDevTools({ detach: true });
// Emitted when the window is closed.
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
// tslint:disable-next-line:no-null-keyword
mainWindow = null;
});
}