JavaScript multithreading

后端 未结 5 1766
不知归路
不知归路 2020-12-02 20:44

I\'m working on comparison for several different methods of implementing (real or fake) multithreading in JavaScript. As far as I know only webworkers and Google Gears Worke

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 21:15

    There is no direct support for multithreading in JavaScript. However you can achieve this by applying some ideas and method.

    There are methods like:

    var id = window.timeout("javascript code", time);
    

    here the JavaScript code is called after the specifed time and we can use

    window.clearTimeout(id);
    

    for clearing. By this we can achieve fake concurrency.

提交回复
热议问题