dmikester1D
Reactiflux4y ago
3 replies
dmikester1

dmikester1 – 06-04 Dec 22

I'm building my first Electron app. I have a renderer.js file on the front side with some js code. I just want to get acess to this filelist outside of the async/await code.
// get list of files from the `main` process
const getFileList = async () => {
  const filelistDiv = document.querySelector("#filelist");
  const filelist = await window.fsInfo.getDirContents();
    return filelist;
};

const filelist = getFileList();
console.log(filelist)

let fileListItems = '';
filelist.forEach(element => {
        console.log(element);
    });
  filelistDiv.innerText = filelist;
Was this page helpful?