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


TypeScript BrowserWindow.once方法代码示例

本文整理汇总了TypeScript中electron.BrowserWindow.once方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserWindow.once方法的具体用法?TypeScript BrowserWindow.once怎么用?TypeScript BrowserWindow.once使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.BrowserWindow的用法示例。


在下文中一共展示了BrowserWindow.once方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: openMainWindow

export function openMainWindow() {
  console.log('open main window')

  mainWindow = new BrowserWindow({
    width: 1200,
    height: isDev ? 900 : 720, // create room for dev tools
    show: false
  })
  mainWindow.loadURL(`file://${getAppFolder()}/src/main.html`)

  if (isDev) {
    mainWindow.webContents.openDevTools()
  }

  mainWindow.once('ready-to-show', () => {
    useShortcut('CommandOrControl+D', mainWindow)
    
    mainWindow.show()
    mainWindow.focus()
  })

  mainWindow.on('closed', () => {
    unregisterShortcuts(mainWindow)
    mainWindow = null
  })
}
开发者ID:haimich,项目名称:billy,代码行数:26,代码来源:windows.ts

示例2: openOnboardingWindow

export function openOnboardingWindow() {
  console.log('open onboarding window')

  onboardingWindow = new BrowserWindow({
    width: 450,
    height: 320,
    show: false,
    resizable: false,
    titleBarStyle: 'hidden',
    type: 'splash'
  })
  onboardingWindow.loadURL(`file://${getAppFolder()}/src/onboarding.html`)

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

  ipcMain.on('onboarding-finished', () => {
    openMainWindow()
    onboardingWindow.close()
  })

  onboardingWindow.on('closed', () => {
    onboardingWindow = null
  })
}
开发者ID:haimich,项目名称:billy,代码行数:26,代码来源:windows.ts

示例3: BrowserWindow

app.on('ready',() =>{    
    tcp.listen(3999,()=>{
        console.log('Lisening :3999')
    })
    let win = new BrowserWindow({width: 800, height: 600})
    // win.openDevTools()

    win.once('focus', () => win.flashFrame(false))
    win.flashFrame(true)    
});
开发者ID:yafengli,项目名称:project-samples,代码行数:10,代码来源:main.ts

示例4:

  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

示例5: createWindow

function createWindow() {
    win = new BrowserWindow({ width: 800, height: 600, show: false });
    win.setMenu(null);
    win.setMenuBarVisibility(false);
    win.maximize();
    win.loadURL("http://localhost:8080");

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

    win.on("closed", () => {
        win = null;
    });
}
开发者ID:remipassmoilesel,项目名称:Abcmap,代码行数:15,代码来源:electron-main.ts

示例6: BrowserWindow

    () => {
      win = new BrowserWindow({
        width: 565,
        height: 233,
        useContentSize: true,
        title: "loading",
        frame: false,
        show: false
      });

      const index = join(__dirname, "..", "static", "splash.html");
      win.loadURL(`file://${index}`);
      win.once("ready-to-show", () => {
        win.show();
      });
    },
开发者ID:nteract,项目名称:nteract,代码行数:16,代码来源:index.ts

示例7: openSummaryWindow

export function openSummaryWindow() {
  console.log('open summary window')

  summaryWindow = new BrowserWindow({
    width: 1200,
    height: isDev ? 900 : 710, // create room for dev tools
    show: false
  })
  summaryWindow.loadURL(`file://${getAppFolder()}/src/summary.html`)

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

  summaryWindow.on('closed', () => {
    summaryWindow = null
  })
}
开发者ID:haimich,项目名称:billy,代码行数:18,代码来源:windows.ts

示例8: BrowserWindow

ipcMain.on(OPEN_REMOTE_CONTROL, () => {
    if (remoteWindow && !remoteWindow.isDestroyed()) {
        return;
    }
    remoteWindow = new BrowserWindow({
        height: 600,
        width: 400,
        minWidth: 300,
        minHeight: 200,
        backgroundColor: '#222',
        show: false,
        frame: true
    });
    remoteWindow.loadURL('file://' + __dirname + '/remote-control/index.html');
    remoteWindow.setMenu(null);
    remoteWindow.once('ready-to-show', () => {
        remoteWindow.show();
    });
});
开发者ID:michaelbromley,项目名称:skqw,代码行数:19,代码来源:index.ts

示例9: launch

export function launch(filename?: string) {
  const win = new BrowserWindow({
    width: 800,
    height: 1000,
    icon: iconPath,
    title: "nteract",
    show: false
  });

  win.once("ready-to-show", () => {
    win.show();
  });
  const index = path.join(__dirname, "..", "static", "index.html");
  win.loadURL(`file://${index}`);

  win.webContents.on("did-finish-load", () => {
    const menu = loadFullMenu();
    Menu.setApplicationMenu(menu);
    if (filename !== undefined) {
      win.webContents.send("main:load", filename);
    }
    win.webContents.send("main:load-config");
  });

  win.webContents.on("will-navigate", deferURL);

  win.on("focus", () => {
    const menu = loadFullMenu();
    Menu.setApplicationMenu(menu);
  });

  win.on("show", () => {
    const menu = loadFullMenu();
    Menu.setApplicationMenu(menu);
  });

  // Emitted when the window is closed.
  win.on("closed", () => {
    const menu = loadFullMenu();
    Menu.setApplicationMenu(menu);
  });
  return win;
}
开发者ID:nteract,项目名称:nteract,代码行数:43,代码来源:launch.ts

示例10: BrowserWindow

	bus.addListener('git:askpass', (context: ICredentialsContext) => {
		var cachedResult = cache[context.id];

		if (typeof cachedResult !== 'undefined') {
			bus.emit('git:askpass:' + context.id, cachedResult.credentials);
			return;
		}

		if (context.command === 'fetch') {
			bus.emit('git:askpass:' + context.id, { id: context.id, credentials: { username: '', password: '' }});
			return;
		}

		var win = new BrowserWindow({
			alwaysOnTop: true,
			skipTaskbar: true,
			resizable: false,
			width: 450,
			height: platform.isWindows ? 280 : 260,
			show: true,
			title: env.product.nameLong
		});

		win.setMenuBarVisibility(false);

		cache[context.id] = {
			window: win,
			credentials: null
		};

		win.loadURL(require.toUrl('vs/workbench/parts/git/electron-main/index.html'));
		win.webContents.executeJavaScript('init(' + JSON.stringify(context) + ')');

		win.once('closed', () => {
			bus.emit('git:askpass:' + context.id, cache[context.id].credentials);

			setTimeout(function () {
				delete cache[context.id];
			}, 1000 * 10);
		});
	});
开发者ID:1833183060,项目名称:vscode,代码行数:41,代码来源:index.ts


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