流星JavaScript框架如何工作? [英] How does the Meteor JavaScript framework work?

查看:47
本文介绍了流星JavaScript框架如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了 Meteor ,虽然看起来很令人兴奋,但我想知道它是如何工作的.我的意思是常规的Web应用程序是这样工作的: 服务器上有脚本,这些脚本从数据库中获取数据并将其动态添加到网页中,并且用户提交的数据通过其他脚本添加到数据库中.

I came across Meteor and while it seems exciting, I want to know how it works. I mean conventional web applications work like this: You have scripts on server which take data from database and add that dynamically to web-pages and the user-submitted data gets added to databases through some other scrips.

但是这些东西在流星中是如何工作的?流星的不同部分之间如何相互关联?

But how do these things work in Meteor? How are different parts of Meteor related to each other?

推荐答案

Meteor 是一个框架,可以优雅地更新HTML实时.

Meteor is a framework that elegantly updates HTML in realtime.

Meteor的美丽之处在于您仅需要创建模板和数据模型.其余的常规样板代码的其余部分都被隐藏了.您无需编写所有同步代码.

The beauty of Meteor is that you only need to create the templates and the data models. The rest of the usual boilerplate code is hidden away. You don't need to write all the sync-ing code.

流星的关键部分可以使用以下这些部分自己构建:

The key pieces of Meteor could be built yourself using these pieces:

  • It provides templating that updates automatically when your data models do. This is normally done using Backbone.js, Ember.js, Knockout.js, or another tool.

客户端/服务器消息传递是通过 websockets 使用类似 socks.js 与MongoDB的客户端连接确实很棒.它将MongoDB服务器驱动程序复制到客户端.不幸的是,我上次检查时,他们仍在努力保护此数据库连接.

The client side connection to MongoDB is really cool. It replicates the MongoDB-server driver into the client. Unfortunately, last I checked, they were still working on securing this database connection.

延迟补偿只是简单地首先更新客户端模型,然后将更新发送到服务器-服务器.

The latency compensation is simply updating the client-side model first, then sending the update to the server-server.

Meteor 网站或 查看全文

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