Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function installDevTools() {
try {
// eslint-disable-next-line
require('devtron').install();
// eslint-disable-next-line
require('vue-devtools').install();
} catch (err) {
// eslint-disable-next-line
console.error(err);
}
}
break;
}
// 然后加载应用的 index.html。
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, getLocalLanguagueSetting),
protocol: 'file:',
slashes: true
}))
// Launch fullscreen with DevTools open, usage: npm run debug
if (debug) {
mainWindow.webContents.openDevTools()
mainWindow.maximize()
require('devtron').install()
}
// 取消引用 window 对象,如果你的应用支持多窗口的话,
// 通常会把多个 window 对象存放在一个数组里面,
// 与此同时,你应该删除相应的元素。
mainWindow.on('closed', function() {
mainWindow = null
})
mainWindow.on('resize', updateReply);
function updateReply() {
// const message = `大小: ${mainWindow.getSize()} - 位置: ${mainWindow.getPosition()}`
// console.log("mainWindow:" + message);
}
height: 840,
title: app.getName(),
}
if (process.platform === 'linux') {
windowOptions.icon = path.join(__dirname, '/assets/app-icon/png/512.png')
}
mainWindow = new BrowserWindow(windowOptions)
mainWindow.loadURL(path.join('file://', __dirname, '/index.html'))
// Launch fullscreen with DevTools open, usage: npm run debug
if (debug) {
mainWindow.webContents.openDevTools()
mainWindow.maximize()
require('devtron').install()
}
mainWindow.on('closed', () => {
mainWindow = null
})
console.log(BrowserWindow.fromId(1));
}
height: 840,
title: app.getName(),
}
if (process.platform === 'linux') {
windowOptions.icon = path.join(__dirname, '/assets/app-icon/png/512.png')
}
mainWindow = new BrowserWindow(windowOptions)
mainWindow.loadURL(path.join('file://', __dirname, '/index.html'))
// Launch fullscreen with DevTools open, usage: npm run debug
if (debug) {
mainWindow.webContents.openDevTools()
mainWindow.maximize()
require('devtron').install()
}
mainWindow.on('closed', () => {
mainWindow = null
})
}
nodeIntegration: true
}
}
if (process.platform === 'linux') {
windowOptions.icon = path.join(__dirname, '/assets/app-icon/png/512.png')
}
mainWindow = new BrowserWindow(windowOptions)
mainWindow.loadURL(path.join('file://', __dirname, '/index.html'))
// Launch fullscreen with DevTools open, usage: npm run debug
if (debug) {
mainWindow.webContents.openDevTools()
mainWindow.maximize()
require('devtron').install()
}
mainWindow.on('closed', () => {
mainWindow = null
})
}
function setupApp (store) {
setupSource()
disableDragDrop()
makeEngine()
loadPerf()
if (devStoreChangingFunctions) {
window.devEdit = (path, value) => store.dispatch(devEditAction(path, value))
}
if (__DEV__ && process.env.KEYBASE_LOCAL_DEBUG) {
require('devtron').install()
}
setupContextMenu(electron.remote.getCurrentWindow())
// Used by material-ui widgets.
if (module.hot) {
// Don't reload this thing if we're hot reloading
if (module.hot.data === undefined) {
injectTapEventPlugin()
}
} else {
injectTapEventPlugin()
}
ipcRenderer.on('dispatchAction', (event, action) => {
// we MUST convert this else we'll run into issues with redux. See https://github.com/rackt/redux/issues/830
function setupApp(store) {
setupSource()
disableDragDrop()
const eng = makeEngine(store.dispatch, store.getState)
loadPerf()
if (__DEV__ && process.env.KEYBASE_LOCAL_DEBUG) {
require('devtron').install()
}
setupContextMenu(electron.remote.getCurrentWindow())
// Tell the main window some remote window needs its props
ipcRenderer.on('remoteWindowWantsProps', (event, windowComponent, windowParam) => {
store.dispatch({type: 'remote:needProps', payload: {windowComponent, windowParam}})
})
// Listen for the menubarWindowID
ipcRenderer.on('updateMenubarWindowID', (event, id) => {
store.dispatch({type: 'remote:updateMenubarWindowID', payload: {id}})
})
ipcRenderer.on('dispatchAction', (event, action) => {
// we MUST convert this else we'll run into issues with redux. See https://github.com/rackt/redux/issues/830
function setupApp(store) {
setupSource()
disableDragDrop()
makeEngine()
loadPerf()
setupAvatar()
if (devStoreChangingFunctions) {
window.devEdit = (path, value) => store.dispatch(devEditAction(path, value))
}
if (__DEV__ && process.env.KEYBASE_LOCAL_DEBUG) {
require('devtron').install()
}
setupContextMenu(electron.remote.getCurrentWindow())
// Used by material-ui widgets.
if (module.hot) {
// Don't reload this thing if we're hot reloading
if (module.hot.data === undefined) {
injectTapEventPlugin()
}
} else {
injectTapEventPlugin()
}
ipcRenderer.on('dispatchAction', (event, action) => {
// we MUST convert this else we'll run into issues with redux. See https://github.com/rackt/redux/issues/830
webPreferences: {
nodeIntegration: false,
preload: require.resolve('./create-window-preload')
}
});
win.maximize();
win.loadURL(address);
win.webContents.on('new-window', e => {
e.preventDefault();
});
// Install development tools in dev mode
if (electronIsDev) {
require('devtron').install();
const {
REACT_DEVELOPER_TOOLS,
REACT_PERF,
MOBX_DEVTOOLS
} = require('electron-devtools-installer');
const installDevTool = require('electron-devtools-installer').default;
await installDevTool(REACT_DEVELOPER_TOOLS);
await installDevTool(REACT_PERF);
await installDevTool(MOBX_DEVTOOLS);
}
return win;
}
// when you should delete the corresponding element.
CONTEXT.window = undefined;
});
// Disable navigation on the host window object, triggered by system drag and drop
win.webContents.on('will-navigate', e => {
e.preventDefault();
});
win.webContents.on('new-window', e => {
e.preventDefault();
});
// Install development tools in dev mode
if (electronIsDev) {
require('devtron').install();
const {
REACT_DEVELOPER_TOOLS,
REACT_PERF,
MOBX_DEVTOOLS
} = require('electron-devtools-installer');
const installDevTool = require('electron-devtools-installer').default;
await installDevTool(REACT_DEVELOPER_TOOLS);
await installDevTool(REACT_PERF);
await installDevTool(MOBX_DEVTOOLS);
}
checkForUpdates(win);
CONTEXT.window = win;