How to do Threading in Javascript

前端 未结 4 1952
栀梦
栀梦 2020-12-06 05:53

So I have a large JSON object i\'m returning from the server, then building a datatable from it and displaying it on the form. This usually takes a few seconds.. so I was th

4条回答
  •  半阙折子戏
    2020-12-06 06:06

    [Added my comment as an answer]

    JavaScript is single threaded. You'll have to break your work up into pieces and call them in sequence using "setTimeout" to allow the GUI to update during processing (in between your calls) but even then the browser will still seem somewhat unresponsive.

提交回复
热议问题