Issue
I want to display a loading dialog or screen until my data is completely fetched but don't know how to do it I saw some examples about async/await and promises but from there I am not getting any idea.so, please help me if someone knows how to do it.
Solution
You can use a flag variable to decide to show the dialog or not.
let flag = false # disable dialog in default
# bind the update function to some element
async update(){
flag = true # enable dialog before api call
const data = await fetchData() # fetch data
flag = false # disable dialog after all data is fetched
}
Answered By - Zhu Lance Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.