After opening a popover that redirects me to another page and then returning to the root page (popToRoot), I reload the data/dom upon an event and dismiss the popup once the json data is received from the server. Everything works smoothly with a lengthy timeout set for dismissing.
dismissPopup() {
if (this.popover) {
let that = this;
setTimeout(function () {
that.popover.dismiss();
}, 500);
}
}
If I reduce the timeout to 100ms, the dismissal fails because the dom loading process is still ongoing.
However, relying on a timeout may not be the best approach. What if a user has a slow device and the time allotted is insufficient?
Can someone offer any suggestions? Should I wait for the dom to finish loading before calling dismiss? And how do I determine if the dom has loaded completely?
Thank you