I'm fairly new to both F# and Fable. I have the following code in JavaScript to load up some images and then do stuff with them when they're all loaded:
async function start() {
async function loadImages(files) {
let promises = files.map(filename => {
return new Promise((resolve, reject) => {
const img = new Image();
img.src = filename;
img.onload = () => resolve(img);
})
});
return Promise.all(promises);
}
const images = await loadImages(imageFileNames);
// Do stuff with images
console.log('images loaded', images);
}
start();
How would I go about writing this in F# for use in Fable?
I'm using the Fable Simple Template (which I believe is Fable 1.x not the new version 2?)