Problems with NW not fully closing? Try this!

0 favourites
  • 10 posts
From the Asset Store
you can add, remove and reorder list items and many more
  • So in the bugs forum many people have been reporting a problem where NW.JS games don't fully close when exiting- they seem to close but processes are left behind, taking up resources. That thread is here:

    So I've been working on a crudely-implemented but seemingly effective solution to this problem. If it works for other people then hopefully someone who actually knows what they're doing can redo my work in a better way. So this isn't really a full fix, but I think its a good start.

    (EDIT- see the next post for an updated solution)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok I worked on it a little more with the help of a programmer friend and we figured out a better way. Ignore the solution in the first post.

    1. Find your exported project's package.nw file and open it (it can be opened as a zip archive, you can even rename it to a .zip file if you remember to change it back after).

    2. Open up the index.html file inside that archive.

    3. Paste this code right before the last closing </script> tag:

    var win = window['nwgui'].Window.get();

    win.on('close', function () {

    window['nwgui'].App.quit();

    });

    4. Save the new index.html file and the changed package.nw.

    5. Test out your game to see if all processes close fully upon exit.

  • you can test with this plugin nodewebkit extended

  • Pretty sure it's a file name issue. Renaming the project and deleting, and redoing the sounds fixes mine.

    With that info, perhaps someone could figure out a fix for capx's.

    Something like renaming the folder or something we don't have access to in the editor.

  • you can test with this plugin nodewebkit extended

    I saw that in the other thread, but I'd prefer to have a solution where the user can close the window with the X like normal.

    Pretty sure it's a file name issue. Renaming the project and deleting, and redoing the sounds fixes mine.

    With that info, perhaps someone could figure out a fix for capx's.

    Something like renaming the folder or something we don't have access to in the editor.

    Does pasting my code into the index.html work for you? If that does work there's probably a way to insert it into the template index.html so it shows up in all exports automatically.

  • I add an event emitter, the user could close with window 'X'

  • I add an event emitter, the user could close with window 'X'

    Oh yeah? Can you explain further?

  • when the user click on window X, windows.close is send so I add an event when .close is send, I launch App.quit

  • > Pretty sure it's a file name issue. Renaming the project and deleting, and redoing the sounds fixes mine.

    > With that info, perhaps someone could figure out a fix for capx's.

    > Something like renaming the folder or something we don't have access to in the editor.

    >

    Does pasting my code into the index.html work for you? If that does work there's probably a way to insert it into the template index.html so it shows up in all exports automatically.

    I'm not talking about a hack. Changing the xml in a capx can offer a fix.

    Nwjs changed its file structure, and thats the reason for the ghost processes.

    I lack the knowledge to figure out where the issue is.

  • Thanks! Your solution worked for me!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)