open-pv / simshady

Simulating Shadows for PV Potential Analysis on 3D Data in the Browser :sunny:
https://open-pv.github.io/simshady/
Apache License 2.0
5 stars 0 forks source link

Add callback function for progress bar #7

Closed FlorianK13 closed 2 months ago

FlorianK13 commented 2 months ago

Something like this:

function runSimulation(steps, progressCallback) {
    for (let step = 0; step < steps; step++) {
        simulateStep(step);
        const progress = (step + 1) / steps * 100;
        progressCallback(progress);
    }
}

function updateProgressBar(progress) {
    console.log(`Progress: ${progress}%`); // Replace this with actual UI update logic
}

runSimulation(100, updateProgressBar);