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