How to do Threading in Javascript

前端 未结 4 1949
栀梦
栀梦 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

    You can try using WebWorker: https://developer.mozilla.org/en/DOM/Worker
    Thus worker are executed in parallel of the main thread, you cannot exactly achieve multi-threading using workers: you cannot modify the UI from a worker.
    You can maybe create your grid as a string in a worker and when the worker finish, append it where you want.

提交回复
热议问题