Created
December 6, 2020 17:51
-
-
Save lisamesserli/891c56f76235d4602590bd2c78555ce3 to your computer and use it in GitHub Desktop.
Electron Beispiele
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 createWindow = () => { | |
mainWindow = new BrowserWindow({ | |
width: 2600, height: 600, | |
minWidth: 500, minHeight: 300 | |
}); | |
}; |
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 colorPicker = new TouchBar.TouchBarColorPicker({ | |
availableColors: ['#cceb34', '#2de3d1', '#2d4fd1', '#2dbce3'] | |
}); |
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
app.on('window-all-closed', () => { | |
debugger | |
if (process.platform !== 'darwin') { | |
app.quit(); | |
} | |
}); |
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
<body style="user-select: none; background-color: lightslategrey"> |
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
"devDependencies": { | |
"@electron-forge/cli": "^6.0.0-beta.54", | |
"@electron-forge/maker-deb": "^6.0.0-beta.54", | |
"@electron-forge/maker-rpm": "^6.0.0-beta.54", | |
"@electron-forge/maker-squirrel": "^6.0.0-beta.54", | |
"@electron-forge/maker-zip": "^6.0.0-beta.54", | |
"electron": "11.0.2", | |
"electron-rebuild": "^2.3.2", | |
"nodemon": "^2.0.6" | |
} |
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
mainWindow.webContents.openDevTools(); |
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
<a href="https://www.electronjs.org" target="_blank">Electron Website!</a> |
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
mainWindow = new BrowserWindow({ | |
width: 2600, height: 600, | |
webPreferences: { | |
partition: 'persist:ort' | |
} | |
}); |
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
"withReload": "nodemon --exec electron-forge start" |
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 touchBar = new TouchBar({ | |
items: [colorPicker] | |
}); |
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 {TouchBar} = require('electron'); |
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
if(process.platform === 'darwin'){ | |
mainWindow.setTouchBar(touchBar); | |
} |
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
mainWindow.webContents.on("new-window", (event, url) => { | |
event.preventDefault(); | |
mainWindow.loadURL(url); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment