当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Tray.setTitle方法代码示例

本文整理汇总了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;
    });
}
开发者ID:istvan-antal,项目名称:timetrack,代码行数:53,代码来源:main.ts


注:本文中的electron.Tray.setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。