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;
// 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;
UU
Unknown User483d ago
D
dmikester1483d ago
I mean I would like to be able to use filelist outside/after the const getFileList = async () => { function. Is that at all possible? This is all in a vanilla js file loaded directly into the html via script tag.
UU
Unknown User482d ago