Comments (15)
Sorry for talking about something not related, but this might be a good time to add an issue template with steps to reproduce and context to approach problems better.
from electron-with-express.
Yep thank you so much @vzqzac for the pull request. I've merged it.
from electron-with-express.
The thing is, is that the BrowserWindow is a different process than the server so while the window will close it won't automatically close the server. Have a look at this issue: #11 as this method was adopted. Before you close the browser window send an IPC message 'stop-server' so that the server will close.
That said, this method is a stop gap measure, we can do better than this and we really should. If you play around with the code and find a better way to do it please send a pull request.
from electron-with-express.
yes okay but there is already an event
on("close", ...)
with
mainWindow.webContents.send('stop-server');
in main.js
.
Then why when I do windoww.close();
does the server not close?
from electron-with-express.
Then why when I do windoww.close(); does the server not close?
All I can say is that the event may not be firing, or the IPC message isn't working so the server isn't being closed. It used to work. When I get some time I'll take a look.
from electron-with-express.
What platform are you on? I have been looking at this today and I cannot reproduce the issue on Windows 10.
from electron-with-express.
I'm running from command line using npm start
and then I close the Electron window and the processes are all closing as expected. They are all closing even without the extra bit of code to tell the server to quit. So I think Windows is taking care of it but this may be an issue on Linux or Mac but I'm not sure.
from electron-with-express.
are you on a platform other than Windows?
from electron-with-express.
Sorry I don't think to check my emails... Yes, I'm on Linux. But the server does not close only when I close the application with win.close()
from electron-with-express.
It could be that the Window close event that is standard bypasses the Electron BrowserWindow close event. That's interesting and I'd think it'd be a bug in Electron if that were the case. I'll have to try on a Linux VM to see how it behaves. Give me some time because I just started a new job this morning.
from electron-with-express.
Totally agree @vzqzac !!!! If you have some ideas for this template please let me know and I'll gladly incorporate those ideas into it =)
Thank you for the suggestion!!!
from electron-with-express.
@vzqzac I don't even know how to create a issue template. Is this something that is added to the code repo and then is used by the issue tracker? Can you show me how to do it or point me to a reference on how to do it?
from electron-with-express.
Thanks for your response @frankhale, I just opened #16 with what I think is the proper information to add the templates, I'd appreciate your review there and of course any change request is highly appreciated too!
from electron-with-express.
So as I rewrite this I am finding that this is a really big problem. Sometimes the processes will exit and other times they won't. This is super annoying. I wonder if it's any better on Linux or Mac. Windows is a serious pain in the @$$!
from electron-with-express.
Closing this in favor of tracking this in #21
from electron-with-express.
Related Issues (20)
- Building the application with electron-builder, it doesn't work. HOT 2
- console.log() doesn't work HOT 1
- Support both win32 and win64 HOT 1
- Sending messages to main process from express-app process HOT 6
- electron-with-express rewrite HOT 10
- Express process is not killed if app closes before window has created HOT 8
- Security warnings HOT 4
- Key binding for F1 (Server Log) doesn't work anymore HOT 4
- electron-packager build not starting express server. HOT 3
- After create exe jquery module not found is showin HOT 3
- if access the page from chrome, the express app will report error in log HOT 4
- require('electron').remote.app.getAppPath() no longer working HOT 2
- Productive build, there is no more index.html with line 64 anymore HOT 1
- new version remote electron @electron/remote HOT 3
- License mismatch between package.json and LICENSE HOT 1
- ff059291d16250f548ef05aac52aefdd4507fd09
- Question: Why use a html to load the server file? HOT 9
- add mongodb to the app HOT 2
- How to use ipcRenderer from Express? HOT 3
- Only loading when I packaged using packager and run the exe file. it is not loading the ejs file. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-with-express.