zoukankan      html  css  js  c++  java
  • Electron快速入门之事件

    const { app, BrowserWindow } = require('electron')

    function createWindow () {
      const win = new BrowserWindow({
         800,
        height: 600,
        webPreferences: {
          nodeIntegration: true
        }
      })

    //webcontents

    win.webContents.on("did-finish-load",()=>{
      console.log("did-finish-load");
    })

    win.webContents.on("dom-ready",()=>{
      console.log("dom-ready");
    })

      win.loadFile('index.html')
    }
    //加载完成事件
    app.whenReady().then(()=>{
      console.log("------whenReady------");
      createWindow()})
    //所有窗口被关闭 
    app.on('window-all-closed', () => {
      console.log("'window-all-closed");
      if (process.platform !== 'darwin') {
        app.quit()
      }
    })

    app.on('activate', () => {
      if (BrowserWindow.getAllWindows().length === 0) {
        createWindow()
      }
    })

    // ready:当electron完成初始化时被触发

    // window-all-closed:所有窗口被关闭

    // before-quit:应用程序开始关闭窗口之前被触发

    // will-quit:当所有窗口都已经关闭并且应用程序将退出时发出

    // quit:在应用程序退出时发出
    // https://www.electronjs.org/docs/all 文档
  • 相关阅读:
    二分搜索
    Shell 字符串处理、获取文件名和后缀名
    sqlldr使用说明
    Linux cached过高问题
    算法时间复杂度
    #if,#ifdef,#ifndef的区别
    memcpy momove strcmp源码实现
    怎么解决/bin/sh: arm-linux-gcc: not found make
    性能文章
    linux
  • 原文地址:https://www.cnblogs.com/q1359720840/p/14375744.html
Copyright © 2011-2022 走看看