Access function in app.js from browser-windoe file


#1

Hey guys!
I’m currently coding some stuff and I need some functions like hide the window.

So I created a small function

  global.area = {
    close: function() {
      desktopArea.hide();
    }
  };

that’s my global function so I call it here

	document.addEventListener("keydown", function (e) {
		if (e.which === 123) {
			remote.getCurrentWindow().toggleDevTools();
		} else if (e.which === 116) {
			location.reload();
		} else if(e.which == 27) {
      remote.getGlobal('area').close;
    }
	});

so when I press ESC it happend nothing. What I’m doing wrong?
Regards


#2

the app.js is in a separate VM… need to use ipcMain to send to it…

Similar issue with the prompt popup window… so this might help