2

I am developing a hybrid application using cordova. I have added ionic loading indicator for one activity. But I have observed that ionic loading indicator stops spinning when the code execution enters in a file which is a pure javascript file.

If you have any solution to make it spin while the code execution is in the pure Javascript file please let me know.

Any suggestions will be appreciated. Thank you in advance.

1 Answer 1

1

What is that raw javascript file does?

My guess is that you're probably doing a request and waiting for it synchronously. So it's normal that the spin freeze. You have to make your request asynchronous.

If it's doing something else that take a lot of time you may use multiple call to setTimeout([function],0); so your browser won't freeze.

EDIT : Add the link from my comment : Javascript async loop processing

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you for your suggestion. Let me try it out.
So what do you have in your raw js file ? a long process or a synchronous request ? it will be easier if i know what it is.
It is a synchronous request. Actually I am generating a PDF file using jsPDF and that javascript file contains many function related to it and these all functions are called synchronously. It takes around 5 seconds to execute.
So it's not a server request. The only way to make it "asynchronous-like" is the trick with setTimeout(fn,0). Check the accepted answer there stackoverflow.com/questions/9772400/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.