dmikester1
dmikester12y ago

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;
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
dmikester1
dmikester12y 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.
reactibot
reactibot2y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1055365257469632573