Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

electron preload to renderer

// Use the contextBridge module to accomplish this securely:

// preload.js
const { contextBridge } = require('electron')

contextBridge.exposeInMainWorld('myAPI', {
  desktop: true
})

// renderer.js
console.log(window.myAPI)
// => { desktop: true }
Source by www.electronjs.org #
 
PREVIOUS NEXT
Tagged: #electron #preload #renderer
ADD COMMENT
Topic
Name
5+4 =