main.js 518 字节
const {app, BrowserWindow} = require('electron')

app.disableHardwareAcceleration()

let win
app.once('ready', () => {
  win = new BrowserWindow({
    webPreferences: {
      offscreen: true
    }
  })
  win.loadURL('http://github.com')

  var now = Date.now()
  
  win.webContents.on("paint", function(event, dirty, image){
  console.log(
    "painting", 
    Date.now() - now, 
    win.webContents.isOffscreen(), 
    win.webContents.getFrameRate()
  )

  now = Date.now()
  })
  win.webContents.setFrameRate(20)
})