I'm building an app on electron and now I'm trying to create a simple file. Here's the JS:
const app = require("electron").remote;
var dialog = app.dialog;
var fs = require("fs");
document.getElementById('save_project').onclick=() => {
    dialog.showSaveDialog((filename) => {
      if(filename === undefined){
        console.log("You didnt save the file");
        return;
      };  
      var content = "hello there";
      fs.writeFile(filename, content, (err) => {
        if(err) console.log(err);
        alert("The file has been successfully saved.")
      })
    });
};
This window will open as supposed:

Then, I wrote for instance: "hello.txt" on the name input and clicked save.
There's no log written on the console neither a file written in the directory
Edit: with this js, happens the same ():
  const fs = require("fs");
  const {dialog} = require("electron").remote;
document.getElementById("save_project").addEventListener("click", () => {
  dialog.showSaveDialog((filename) => {
    if(filename === undefined){
      console.log("nop");
      return;
    }
    fs.writeFile(filename, content, (err) => {
      if(err){
        console.log(err);
        return;
      }
      alert("file created");
    });
  });
}, false);
Edited: Here's the createWindow()
function createWindow () {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 1920,
    height: 1080,
    webPreferences: {
      preload: path.join(__dirname, "preload.js"),
      nodeIntegration: true
    },
  });
  const childWindow = new  BrowserWindow ({ width: 1600, height: 800, parent: mainWindow, modal: true, show : false});
  // and load the index.html of the app.
  mainWindow.loadFile("index.html");
  childWindow.loadFile("welcome.html");
  childWindow.once("ready-to-show", () =>  {
  childWindow.show();
  });
  // Open the DevTools.
  mainWindow.webContents.openDevTools();
}
