skip to Main Content

Javascript – How to dismiss a loading overlay when all promises are settled when promises are continuously added

I have the following class that I'm using to route all my API requests through class PromiseBroker { #promises = {}; #overlayEle = document.getElementById('loading-overlay'); constructor(){ } get promises(){ return this.#promises; } setPromise(key, value){ this.promises[key] = value; this.#overlayEle.classList.remove('d-none'); Promise.allSettled(Object.values(this.promises)).then(results => {…

VIEW QUESTION
Back To Top
Search