當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript BrowserWindow.setFullScreen方法代碼示例

本文整理匯總了TypeScript中electron.BrowserWindow.setFullScreen方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserWindow.setFullScreen方法的具體用法?TypeScript BrowserWindow.setFullScreen怎麽用?TypeScript BrowserWindow.setFullScreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在electron.BrowserWindow的用法示例。


在下文中一共展示了BrowserWindow.setFullScreen方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: _setBounds

 private _setBounds(): void {
   if (this._state.isFullScreen) {
     this._window.setFullScreen(true)
   } else if (this._state.isMaximized) {
     this._window.maximize()
   } else {
     this._window.setBounds(this._state.bounds!)
   }
 }
開發者ID:,項目名稱:,代碼行數:9,代碼來源:

示例2:

  main.on('close', event => {
    if (!isQuitting) {
      event.preventDefault();
      logger.log('Closing window...');

      if (main.isFullScreen()) {
        logger.log('Fullscreen detected, leaving full screen before hiding...');
        main.once('leave-full-screen', () => main.hide());
        main.setFullScreen(false);
      } else {
        main.hide();
      }
    }
    systemMenu.unregisterShortcuts();
  });
開發者ID:wireapp,項目名稱:wire-desktop,代碼行數:15,代碼來源:main.ts

示例3: createWindow

function createWindow(config: Config, icon_path: string) {
    const display_size = screen.getPrimaryDisplay().workAreaSize as DisplaySize;

    function getConfigLength(key: 'width'|'height'): number {
        const len = config[key];
        const default_len = default_config[key] as number;
        switch (typeof len) {
            case 'string': {
                if (len === 'max') {
                    return display_size[key];
                }
                return default_len;
            }
            case 'number': {
                return len as number;
            }
            default: {
                return default_len;
            }
        }
    }

    const config_width = getConfigLength('width');
    const config_height = getConfigLength('height');
    const win_state = windowState({
        defaultWidth: config_width,
        defaultHeight: config_height,
    });

    let options: Electron.BrowserWindowConstructorOptions;

    if (config.restore_window_state) {
        options = {
            x: win_state.x,
            y: win_state.y,
            width: win_state.width,
            height: win_state.height,
        };
    } else {
        options = {
            width: config_width,
            height: config_height,
        };
    }

    options.icon = icon_path;
    options.autoHideMenuBar = config.hide_menu_bar;
    options.show = false;
    if (config.hide_title_bar) {
        options.titleBarStyle = 'hiddenInset';
    }

    const win = new BrowserWindow(options);

    win.once('ready-to-show', () => {
        win.show();
    });

    if (config.restore_window_state) {
        if (win_state.isFullScreen) {
            win.setFullScreen(true);
        } else if (win_state.isMaximized) {
            win.maximize();
        }
        win_state.manage(win);
    }

    return win;
}
開發者ID:Sheshouzuo,項目名稱:Shiba,代碼行數:69,代碼來源:mainu.ts

示例4:

 click: (item: object, focusedWindow: BrowserWindow) => {
   if (focusedWindow) {
     focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
   }
 }
開發者ID:nteract,項目名稱:nteract,代碼行數:5,代碼來源:menu.ts

示例5: open_window

function open_window(access: AccessToken) {
    'use strict';
    log.debug('Starting to open window');

    const win_state = windowState({
        defaultWidth: 600,
        defaultHeight: 800,
    });

    const index_html = 'file://' + join(__dirname, '..', 'index.html');
    const icon_path = join(__dirname, '..', 'images', 'icon.png');
    win = new BrowserWindow({
        x: win_state.x,
        y: win_state.y,
        width: win_state.width,
        height: win_state.height,
        titleBarStyle: 'hidden-inset',
        autoHideMenuBar: true,
        icon: icon_path,
    });

    win.once('closed', () => { win = null; });

    if (win_state.isFullScreen) {
        win.setFullScreen(true);
    } else if (win_state.isMaximized) {
        win.maximize();
    }
    win_state.manage(win);

    if (access.token && access.token_secret) {
        win.webContents.on('dom-ready', () => {
            log.debug('dom-ready: Ready to connect to Twitter API');
            const twitter = new Twitter();
            twitter.prepareClient({
                consumer_key,
                consumer_secret,
                access_token: access.token,
                access_token_secret: access.token_secret,
            });
            twitter.sender = new IpcSender(win.webContents);

            if (should_use_dummy_data) {
                twitter
                    .sendDummyAccount()
                    .then(() => twitter.sendDummyStream())
                    .catch(e => log.error('Unexpected error on dummy stream:', e));
                return;
            }

            twitter
                .sendAuthenticatedAccount()
                .catch(err => {
                    if (!err || (err instanceof Error) || err[0].code !== 32) {
                        log.error('Unexpected error on verifying account:', err);
                        return;
                    }
                    log.debug('Retry authentication flow');
                    return authenticate(consumer_key, consumer_secret)
                        .then((a: AccessToken) => {
                            if (!a.token || !a.token_secret) {
                                log.error('Invalid access tokens:', a);
                                return;
                            }
                            twitter.prepareClient({
                                consumer_key,
                                consumer_secret,
                                access_token: a.token,
                                access_token_secret: a.token_secret,
                            });
                        })
                        .then(() => twitter.sendAuthenticatedAccount())
                        .catch(e => {
                            log.error('Give up: Second authentication try failed.  If you use environment variables for tokens, please check them:', e);
                        });
                })
                .then(() => Promise.all([
                    twitter.fetchMuteIds(),
                    twitter.fetchNoRetweets(),
                    twitter.fetchBlockIds(),
                    twitter.fetchHomeTimeline(),
                    twitter.fetchMentionTimeline(),
                ]))
                .then(([mute_ids, no_retweet_ids, block_ids, tweets, mentions]) => {
                    // Note: Merge mute list with block list
                    for (const m of mute_ids) {
                        if (block_ids.indexOf(m) === -1) {
                            block_ids.push(m);
                        }
                    }
                    log.debug('Total rejected ids: ', block_ids.length);
                    twitter.sender.send('yf:rejected-ids', block_ids);
                    twitter.sender.send('yf:no-retweet-ids', no_retweet_ids);
                    for (const tw of tweets) {
                        twitter.sender.send('yf:tweet', tw);
                    }
                    twitter.sender.send('yf:mentions', mentions);
                })
                .then(() => twitter.connectToStream())
                .catch((e: any) => log.error('Unexpected error on streaming', e));
//.........這裏部分代碼省略.........
開發者ID:DevenLu,項目名稱:YourFukurou,代碼行數:101,代碼來源:main.ts

示例6:

 click:() => {
   mainWindow.setFullScreen(!mainWindow.isFullScreen());
 }
開發者ID:hivaga,項目名稱:angular2-seed,代碼行數:3,代碼來源:start.desktop.ts


注:本文中的electron.BrowserWindow.setFullScreen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。