Skip to content

Instantly share code, notes, and snippets.

@nornagon
Created June 1, 2021 21:03
Show Gist options
  • Select an option

  • Save nornagon/b72948eafa5a2f61acf9f4718ff09259 to your computer and use it in GitHub Desktop.

Select an option

Save nornagon/b72948eafa5a2f61acf9f4718ff09259 to your computer and use it in GitHub Desktop.
Electron Fiddle Gist
<script>
setImmediate(async () => {
if (!location.hash) {
const p = new Promise(resolve => {
window.addEventListener('message', resolve, { once: true });
})
window.open('#foo', '', 'nodeIntegration=no')
const e = await p
document.body.textContent = e.data
} else {
window.opener.postMessage('foo', '*')
}
})
</script>
test
const {app, BrowserWindow} = require('electron')
function createWindow () {
const mainWindow = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
nativeWindowOpen: true,
}
})
mainWindow.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment