Can anyone explain to me how to get js variable in html into main.js before quit


#1

Hi so i am on my way to learn electron and its just awesome.
anyway i got a simple case here for example i have main.js who call index.html same as the tutorial electron tell.
in my index.html

<div id='data' class='container'>
    <div>One</div>
    <div>Two</div>
    <div>Three</div>
  </div>

and on my main.js i tell app to listen on “before quit” event and i want to get a log every #data > div text on the index.html element before quit.

app.on('before-quit', function(e) {
   #console log the One, Two, Three?
   e.preventDefault();

});

How to achieve that Thanks :slight_smile:


#2

You can communicate between the main process and the renderer with the main process ipc and renderer ipc modules.


#3

Thank you will look into it.