'Electron - can't use file js

i try to do an application, but my javascript file is not used, because i don't see the log. i need to do something more than the "quick start" off electron ?

==============================index.html================================

<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->


Sauvegarde de Manga




  <h1>Sauvegarde de Manga</h1>
  
  
  


  
    <p>Titre</p>
    <p>Commentaire</p>
    <p>Note</p>
    <p>Lien</p>
    <p>Dernier episode vu</p>
  
  <div class="tableau">
    <input type="text"  value="" id="titre">
    <input type="text"  value="" id="commentaire">
    <select name="cars" id="note">
      <option value="0">0</option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
      <option value="7">7</option>
      <option value="8">8</option>
      <option value="9">9</option>
      <option value="10">10</option>
      <option value="11">11</option>
      <option value="12">12</option>
      <option value="13">13</option>
      <option value="14">14</option>
      <option value="15">15</option>
      <option value="16">16</option>
      <option value="17">17</option>
      <option value="18">18</option>
      <option value="19">19</option>
      <option value="20">20</option>

    </select>
    <input type="text"  value="" id="ln">
    <input type="text"  value="" id="epvu">
  </div>
</div>
<div class="stock">
  <div class="manga">
    <p>Titre</p>
    <p>Commentaire</p>
    <p>Note</p>
    <input type="submit"value="Regarder" id="lien">
    <p>Dernier episode vu</p>
    <div class="modif">
      <input type="submit" value="M" class="bElement util">
      <input type="submit" value="S" class="bElement util">
    </div>
  </div>

  <div class="manga">
    <p>Titre 2</p>
    <p>Commentaire 2</p>
    <p>Note 2</p>
    <input type="submit"value="Regarder" id="lien" class="bElement">
    <p>Dernier episode vu 2</p>
    <div class="modif">
      <input type="submit" value="M" id="modifier" class="bElement util">
      <input type="submit" value="S" id="supprimer" class="bElement util">
    </div>
  </div>

</div>

===========================main.js=================================== // Modules to control application life and create native browser window const { app, BrowserWindow } = require('electron') const path = require('path')

const createWindow = () => { // Create the browser window. const mainWindow = new BrowserWindow({ width: 800, height: 600, webPreferences: { preload: path.join(__dirname, 'preload.js') } })

// and load the index.html of the app. mainWindow.loadFile('index.html')

// Open the DevTools. // mainWindow.webContents.openDevTools() }

// This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. app.whenReady().then(() => { createWindow()

app.on('activate', () => { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (BrowserWindow.getAllWindows().length === 0) createWindow() }) })

// Quit when all windows are closed, except on macOS. There, it's common // for applications and their menu bar to stay active until the user quits // explicitly with Cmd + Q. app.on('window-all-closed', () => { if (process.platform !== 'darwin') app.quit() })

// In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here.

/* lancer : npm run start Pour avoir un executable : npm i electron-packager --save-dev electron-packager . */

console.log('index'); ===========================other.js=================================== console.log('main'); let retour = document.querySelector('#retour'); let ajout = document.querySelector('#ajouter'); let liste = document.querySelector('#liste'); bindRedirection(retour,'index.html'); bindAjout(ajout); bindListe(liste);

let texttitre = document.querySelector('#titre'); let textcommentaire = document.querySelector('#commentaire'); let select = document.querySelector('#note'); let textln = document.querySelector('#ln'); let textepvu = document.querySelector('#epvu');

let tabelem = [texttitre,textcommentaire,select,textln,textepvu]; bindInput(texttitre, tabelem); bindInput(textcommentaire, tabelem); bindInput(textln, tabelem); bindInput(textepvu, tabelem);

the result but i should have 'main' print after index



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source