简体   繁体   English

meteor.js如何更新模板数据?

[英]How does meteor.js update template data?

Imagine, I have this collection post.js : 想象一下,我有这个收藏post.js:

{
  text: 'Some long text, article',
  likesCount: 10
}

And template file post.html: 和模板文件post.html:

<template name='post'>
  Article - {{text}}
  The number of likes - {{likesCount}}
</template>

Whenever any user likes post, the data is reactively updated. 每当任何用户喜欢发帖时,数据都会进行反应性更新。 Does text is also transferred from database to client on every likesCount update or only likesCount is transferred? 是否在每次LikesCount更新时文本也从数据库传输到客户端,还是仅传输LikesCount This will cause high internet traffic where internet connection cost is high. 在互联网连接成本高的地方,这将导致高互联网流量。

As I understand it, Meteor only transfers the fields that change. 据我了解,流星只传输变化的字段。 You can confirm this for yourself with the Network tab in Developer Tools. 您可以使用开发人员工具中的“网络”标签自行确认。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM