如何最好地解决显示流星集合之前的延迟? [英] How can the delay before displaying meteor collections be best addressed?

查看:95
本文介绍了如何最好地解决显示流星集合之前的延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在显示集合中的项目之前,流星似乎进行了一些处理,使客户端窗口没有更新.如果您在合理的机器上浏览 http://madewith.meteor.com ,则可以看到此直播.我的2.6GHz 4GB RAM笔记本电脑需要大约5秒钟的时间来渲染列表中的项目,在此期间没有任何进展的迹象,并且急于新用户可以合理地认为页面已完成加载.

Before displaying the items from a collection, meteor seems to do some processing that leaves the client window without updates. You can see this live if you surf to http://madewith.meteor.com on a reasonable machine. My 2.6GHz 4GB RAM laptop takes about 5 seconds to render the items in the list, during which there is no indication of progress and a new user in a hurry could reasonably believe the page has finished loading.

是否有一种方法可以递增地显示集合中的项目,以便服务器将网络上的第一批数据推送到客户端,然后在接收到新项目时浏览器呈现这些数据?类似于HTTP的分块传输.

Is there a way to incrementally display items from a collection, such that the server pushes to the client the first items of data on the wire, and the browser renders them, while new items are received? Akin to HTTP's chunked transfer.

Or是加载集合时显示微调器图形的唯一解决方案,类似于 https://atmosphere.meteor .com/(做某事"消息)吗?

Or is the only solution to display a spinner graphic while loading the collection, similar to what https://atmosphere.meteor.com/ does (the "doing something smart" message)?

推荐答案

如果您检查了madewith应用的xhr,您会看到所有(目前有87个)应用都在同一请求中加载.因此,在这种情况下,我认为增量"显示数据不会有所帮助.

If you examine the xhr of the madewith app, you'll see that all (87 at this moment) apps load in the same request. So I don't think 'incrementally' displaying data is going to help in this case.

问题是流星应用程序需要花一些时间进行初始化.我不确定将来是否可以改善这种情况,但是就目前而言,是的,我认为显示微调框是最好的解决方案.

The issue is just that meteor apps take a while to initialise. I'm not sure if this can be improved in the future, but for now, yes, I think displaying a spinner is the best solution.

关于如何知道数据何时准备就绪,可以在集合上使用onReady回调,或查看此 PR 为即将推出的更好解决方案.

Regarding how to know when the data is ready, you can use the onReady callback on a collection, or see this PR for a better solution coming soon.

这篇关于如何最好地解决显示流星集合之前的延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆