This commit is contained in:
parent
3ebe62e589
commit
c7811b64b4
8
main.js
8
main.js
|
|
@ -17,6 +17,7 @@ const cancellationToken = new CancellationToken()
|
||||||
app.allowRendererProcessReuse = false;
|
app.allowRendererProcessReuse = false;
|
||||||
let mainWindow = null;
|
let mainWindow = null;
|
||||||
let isMaximized = false;
|
let isMaximized = false;
|
||||||
|
let env;
|
||||||
|
|
||||||
class AppWindow extends BrowserWindow {
|
class AppWindow extends BrowserWindow {
|
||||||
constructor(config) {
|
constructor(config) {
|
||||||
|
|
@ -36,7 +37,6 @@ class AppWindow extends BrowserWindow {
|
||||||
};
|
};
|
||||||
const finalConfig = { ...basicConfig, ...config };
|
const finalConfig = { ...basicConfig, ...config };
|
||||||
super(finalConfig);
|
super(finalConfig);
|
||||||
const env = process.argv.find((arg) => arg.startsWith('--env='))?.split('=')[1];
|
|
||||||
if (env === 'development') {
|
if (env === 'development') {
|
||||||
// 开发
|
// 开发
|
||||||
this.loadURL('http://localhost:3000');
|
this.loadURL('http://localhost:3000');
|
||||||
|
|
@ -123,7 +123,7 @@ app.on('will-quit', async (event) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
const env = process.argv.find((arg) => arg.startsWith('--env='))?.split('=')[1];
|
env = process.argv.find((arg) => arg.startsWith('--env='))?.split('=')[1];
|
||||||
if (env === 'development') {
|
if (env === 'development') {
|
||||||
Object.defineProperty(app, 'isPackaged', {
|
Object.defineProperty(app, 'isPackaged', {
|
||||||
get() {
|
get() {
|
||||||
|
|
@ -146,9 +146,11 @@ app.on('ready', () => {
|
||||||
}
|
}
|
||||||
// 监听f12打开控制台
|
// 监听f12打开控制台
|
||||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||||
|
if (env === 'development') {
|
||||||
if (input.key === 'F12') {
|
if (input.key === 'F12') {
|
||||||
mainWindow.webContents.openDevTools()
|
mainWindow.webContents.openDevTools()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// 监听移动
|
// 监听移动
|
||||||
mainWindow.on('move', () => {
|
mainWindow.on('move', () => {
|
||||||
|
|
@ -282,9 +284,11 @@ app.on('ready', () => {
|
||||||
});
|
});
|
||||||
newWindow.loadURL(data.url);
|
newWindow.loadURL(data.url);
|
||||||
newWindow.webContents.on('before-input-event', (event, input) => {
|
newWindow.webContents.on('before-input-event', (event, input) => {
|
||||||
|
if (env === 'development') {
|
||||||
if (input.key === 'F12') {
|
if (input.key === 'F12') {
|
||||||
newWindow.webContents.openDevTools()
|
newWindow.webContents.openDevTools()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "multi.person.meeting",
|
"name": "multi.person.meeting",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.1",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"authors": "yj",
|
"authors": "yj",
|
||||||
"description": "test",
|
"description": "test",
|
||||||
|
|
|
||||||
|
|
@ -153,16 +153,11 @@ const App: React.FC = () => {
|
||||||
}, [navigate])
|
}, [navigate])
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (import.meta.env.VITE_ENV !== 'development') {
|
|
||||||
document.addEventListener('keydown', (event) => {
|
document.addEventListener('keydown', (event) => {
|
||||||
if ((event.ctrlKey || event.metaKey) && event.key === 'r') {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
if (event.key === 'F11') {
|
if (event.key === 'F11') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}, [])
|
}, [])
|
||||||
const handleResize = (): void => {
|
const handleResize = (): void => {
|
||||||
setWindowSize({
|
setWindowSize({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue