tisa.utils.runWithLoader(async () => {
console.log("Main operation started...");
// simulation of asynchronous operation
await new Promise(resolve => setTimeout(resolve, 2000));
await tisa.utils.runWithLoader(async () => {
console.log("Sub-operation started...");
// simulation of asynchronous operation
await new Promise(resolve => setTimeout(resolve, 3000));
console.log("Sub-operation completed.");
}, "Processing sub-task...");
// simulation of asynchronous operation
await new Promise(resolve => setTimeout(resolve, 2000));
console.log("Main operation completed.");
}, "Processing main task...");
Function to run an async action with a loading indicator. The loader will be displayed until the action is completed.