Giter VIP home page Giter VIP logo

Comments (4)

sihorton avatar sihorton commented on July 24, 2024

This is a complex issue since chrome (the window) starts its own process and then exits immediately. Also sometimes chrome decides to "join" or re-use an existing browser process that is running, this means that it is quite difficult to detect when the window process closes. However the code is getting better on this point. Try the following:-

  1. Make sure that you have:
    "exitOnAppWinClose": true
    in your app.desk as this will tell node.exe process to exit once the window exits.

  2. Add an on window unload event in your application. This will get called when the window is closed, in this function you can then send a socket message to nodejs and tell it you are exiting. Node can then do process.exit() to terminate itself.

We are still looking for best practices to solve this issue, as we discover good solutions we can update the main deskshell implementation.

from appjs-deskshell.

pakchoidora avatar pakchoidora commented on July 24, 2024

Thanks for replying.
Since a version of chrome which i can't call out.The event window.onunload is desperated, and it won't work any more.
I have a hack way to fix this up, using the chrome extension as that we can make it default to manage window's clos e event,but there still have some problem that Chrome Extension API work strange.API chrome.windows.onRemoved doesn't work every time.So sad and I can't figure this out.

from appjs-deskshell.

sihorton avatar sihorton commented on July 24, 2024

We will be moving to a cef3 based browser instead of chrome soon (code is working on mac already). This should solve the problem, when lanching the window we will get the process id and then know when it closes. This should fix the entire issue as well as give further benefits. So if you can live with the issue for now it should go away soon.

from appjs-deskshell.

lvbeck avatar lvbeck commented on July 24, 2024

I use window.onbeforeunload event instead of window.onunload because the window.onunload also trigger when refresh the window, which is unwanted.

from appjs-deskshell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.