I have a function myFn() that needs to be executed when some specific condition are true in if-else block like below:
if (title === "titleOne") {self.loadingBarOne = true };
if (title === "titleTwo") { self.loadingBarTwo = true };
var myFn = (//this contains the function logic to download a file)
self.loadingBarOne = false;
self.loadingBarTwo = false;
The loadingBars are displayed in the UI after the user clicks download. How do I set the value of loadingBarOne and loadingBarTwo to true for the time myFn() is running, i.e. the file is being downloaded and then set it to false after it is downloaded?
If in case user clicks both download at the same time,the myFn() function should run for both and should be set to false after the respective files are downloaded.