finally fix messy extension code

This commit is contained in:
NodeMixaholic 2023-03-17 19:59:06 -05:00 committed by GitHub
parent 5b2ad9e144
commit 0b46764618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

15
main.js
View file

@ -8,17 +8,15 @@ ipcMain.on('windowmaker', (event, arg) => {
createWindow();
})
function newExtensionSession(mainWindow) {
function createWindow () {
// Create the browser window.
const extensions = new ElectronChromeExtensions({
session: session.defaultSession
})
extensions.addTab(mainWindow.webContents, mainWindow)
}
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
width: 1000,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
@ -31,7 +29,7 @@ function createWindow () {
})
mainWindow.removeMenu()
mainWindow.setMinimumSize(600, 300)
mainWindow.setMinimumSize(1000, 300)
const toBlock = [
@ -103,6 +101,8 @@ const regexPatterns = [
return callback({})
})
extensions.addTab(mainWindow.webContents, mainWindow)
// and load the index.html of the app.
mainWindow.loadFile('index.html')
@ -117,7 +117,6 @@ const regexPatterns = [
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
let x = createWindow()
newExtensionSession(x)
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.