electron/docs/fiddles/media/screenshot/take-screenshot/preload.js

6 lines
208 B
JavaScript
Raw Normal View History

const { contextBridge, ipcRenderer } = require('electron/renderer')
contextBridge.exposeInMainWorld('electronAPI', {
takeScreenshot: () => ipcRenderer.invoke('take-screenshot', window.devicePixelRatio)
})