jQuery and Electron not completely working


#1

After installing jQuery and Electron, and building app, the UI renders but will not close using the File->Exit option or the close window (red X) button. In fact, the only way to close the UI (i.e. to exit the app) is to shutdown Electron (CNTRL-C).

Any suggestions on what might be the issue and/or how to debug?


#4

I’ve used jQuery with electron quite a number of times but have not encountered this problem. Can you further explain how you went about it?


#5

Did you encounter this issue only after installing jQuery?

Assuming you’re building a menu from template yourself, you should add the app.quit() function to click event of the menu item.

Maybe you’re preventing the window from closing using e.preventDefault()? Check the close event of the window you’re trying to close.


#6

I’ve have resolved the issue by adding the following accelerator code to my index.js file in Electron:

const menuTemplate = [
	{
		label: 'File',
		submenu: [
			{ label: 'Configure',
			click() {createAddWindow()}
			},
			{ label: 'Quit',
			  accelerator: 'Ctrl+Q',
			  click() {
			  app.quit();
		      }
		    }
		  ]
    },

    {
      label: 'Tools',
      submenu: [
			  { label: 'Clear File',
			  click() {deleteFile()}
			  }
		    ]
	    }
]

#7

Please format your code as code by highlighting it and pressing the </> button above the editor.


#8

Code reformatted