docs: enable contextIsolation in fiddles (#39613)
This commit is contained in:
parent
2e79f34c84
commit
9280b79112
61 changed files with 206 additions and 233 deletions
|
@ -20,7 +20,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
require('./renderer.js')
|
||||
</script>
|
||||
<script src="renderer.js"></script>
|
||||
</html>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const { app, BrowserWindow, shell } = require('electron/main')
|
||||
const path = require('node:path')
|
||||
|
||||
let mainWindow = null
|
||||
|
||||
|
@ -8,8 +9,7 @@ function createWindow () {
|
|||
height: 400,
|
||||
title: 'Get version information',
|
||||
webPreferences: {
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
const { contextBridge } = require('electron/renderer')
|
||||
|
||||
contextBridge.exposeInMainWorld('electronVersion', process.versions.electron)
|
|
@ -1,8 +1,6 @@
|
|||
const versionInfoBtn = document.getElementById('version-info')
|
||||
|
||||
const electronVersion = process.versions.electron
|
||||
|
||||
versionInfoBtn.addEventListener('click', () => {
|
||||
const message = `This app is using Electron version: ${electronVersion}`
|
||||
const message = `This app is using Electron version: ${window.electronVersion}`
|
||||
document.getElementById('got-version-info').innerHTML = message
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue