开发者

Deserialize big data JSON from a REST request into objects without locking up the browser?

In a rich internet app:

  1. User requests a resource
  2. Server responds with a huge JSON response
  3. Client (running in browser) must process the JSON converting it to the many objects which make up the application state.

Step 3 is intensive and can cause the browser to lock. I was thinking about using web workers but I think they may not be suited for the task.

As I understand workers, they pass messages purely as text or JSON. So while it would be possible for the web worker to accept a message ("please fetch the resource at this URL") the worker could then retrieve the large JSON response and even deserialize it into the many objects making up the app state, but there would be no way to pass objects (instances of various classes) back to the main process via the message passing construct. Right? Or am I missing something?

How would one allow an in-browser client to deserialize big da开发者_Go百科ta into objects without compromising the user experience (locking the browser)? If web workers are out, does that leave using timers (for timeslicing)?


How JavaScript is Slowing Down the Web (And What To Do About It)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜