-
-
Save nornagon/1d1190d6c6d971fe7b938d0d12be8071 to your computer and use it in GitHub Desktop.
Electron Fiddle Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Empty --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {app, BrowserWindow, BrowserView} = require('electron') | |
const APPLY_BROWSER_VIEW_FIX = false; | |
function createWindow () { | |
const mainWindow = new BrowserWindow({ | |
width: 800, | |
height: 600 | |
}) | |
const mainView = new BrowserView({ | |
webPreferences: { | |
nodeIntegration: false, | |
contextIsolation: true, | |
}, | |
}); | |
mainWindow.setBrowserView(mainView); | |
mainView.setBounds({ | |
x: 0, | |
y: 0, | |
width: 800, | |
height: 600, | |
}); | |
mainView.webContents.loadFile('index.html') | |
if(APPLY_BROWSER_VIEW_FIX) { | |
app.on("before-quit", () => { | |
mainWindow.setBrowserView(null); | |
}); | |
} | |
} | |
app.whenReady().then(createWindow) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const { contextBridge } = require("electron"); | |
// class DUJK { | |
// constructor(f) { | |
// this.f = f; | |
// } | |
// } | |
// let g_fn = null | |
// contextBridge.exposeInMainWorld("test", { | |
// // Listen for messages | |
// on: (fn) => g_fn = new DUJK(fn), | |
// }); | |
for (let i = 0; i < 10; i++) { | |
setInterval(() => { | |
(() => {})(function() {}) | |
}, 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is required by the index.html file and will | |
// be executed in the renderer process for that window. | |
// All of the Node.js APIs are available in this process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Empty */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment