當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。