finally fix messy extension code
This commit is contained in:
parent
5b2ad9e144
commit
0b46764618
1 changed files with 7 additions and 8 deletions
15
main.js
15
main.js
|
@ -8,17 +8,15 @@ ipcMain.on('windowmaker', (event, arg) => {
|
||||||
createWindow();
|
createWindow();
|
||||||
})
|
})
|
||||||
|
|
||||||
function newExtensionSession(mainWindow) {
|
function createWindow () {
|
||||||
|
// Create the browser window.
|
||||||
|
|
||||||
const extensions = new ElectronChromeExtensions({
|
const extensions = new ElectronChromeExtensions({
|
||||||
session: session.defaultSession
|
session: session.defaultSession
|
||||||
})
|
})
|
||||||
extensions.addTab(mainWindow.webContents, mainWindow)
|
|
||||||
}
|
|
||||||
|
|
||||||
function createWindow () {
|
|
||||||
// Create the browser window.
|
|
||||||
const mainWindow = new BrowserWindow({
|
const mainWindow = new BrowserWindow({
|
||||||
width: 800,
|
width: 1000,
|
||||||
height: 600,
|
height: 600,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, 'preload.js'),
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
|
@ -31,7 +29,7 @@ function createWindow () {
|
||||||
})
|
})
|
||||||
|
|
||||||
mainWindow.removeMenu()
|
mainWindow.removeMenu()
|
||||||
mainWindow.setMinimumSize(600, 300)
|
mainWindow.setMinimumSize(1000, 300)
|
||||||
|
|
||||||
|
|
||||||
const toBlock = [
|
const toBlock = [
|
||||||
|
@ -103,6 +101,8 @@ const regexPatterns = [
|
||||||
return callback({})
|
return callback({})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
extensions.addTab(mainWindow.webContents, mainWindow)
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
mainWindow.loadFile('index.html')
|
mainWindow.loadFile('index.html')
|
||||||
|
|
||||||
|
@ -117,7 +117,6 @@ const regexPatterns = [
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
let x = createWindow()
|
let x = createWindow()
|
||||||
newExtensionSession(x)
|
|
||||||
app.on('activate', function () {
|
app.on('activate', function () {
|
||||||
// On macOS it's common to re-create a window in the app when the
|
// 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.
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
|
Loading…
Reference in a new issue