Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createWindow() {
const mainWindow = new BrowserWindow({
icon: path.resolve('icons', 'icon.png'),
height: 768,
width: 768,
minHeight: 500,
minWidth: 500,
})
const devtoolBackend = DevtoolBackend.create({
onRelaunch() {
app.relaunch()
app.quit()
},
// This storage requires objects to be stored, for some weird reason
storage: {
get(key) {
return new Promise((resolve) => {
storage.get(key, null, (_, data) => {
if (data) {
resolve(data.value)
}
})
})
},
set(key, value) {
},
set(key: string, value: any) {
return new Promise((resolve) => {
context.workspaceState.update(key, value)
resolve()
})
},
clear() {
return new Promise((resolve) => {
resolve()
})
},
}
const devtoolBackend = DevtoolBackend.create({
onRelaunch() {
devtoolBackend.close()
startDevtools()
},
storage,
})
const devtoolsPanel = new DevtoolsPanel({
context,
onMessage: (command, text) => {
switch (command) {
case 'newPort':
storage.set('overmind-devtools.port', text)
startDevtools()
break
case 'restart':
devtoolBackend.close()