简体   繁体   中英

EXT Js: How to create a thread on load

我希望在EXT js中创建一个线程,该线程会在一段时间间隔后继续进行一次调用,直到浏览器中出现Js。

You can use below code:

setTimeout(function(){ <Make ajax call here> }, <interval in miliseconds>);

Did this solved your issue ?

Javascript does not have the concepts of threads and parallel execution. However, it can fill the execution queue with a function to execute on a regular basis. The javascript function for this is

window.setInterval(fn, milliseconds);

If you really want to repeat the function runs forever, this is a good deal. While you could also stop execution using window.clearInterval , I would not do that if you are already using the ExtJS framework.

Because around these basic functions, ExtJS has created the Task object which you can start and stop at will. The ExtJS solution is more OOP style, which means cleaner code.

To see how to use it, the official Task documentation ist your friend.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM