前端 流星特效

As part of my daily web browsing routine, I follow a number of front-end blogs. I'm always amazed at how far good front-end engineers can push JavaScript and CSS, and how well they are able to master the intricacies of web browsers.

作为日常Web浏览例程的一部分,我关注了许多前端博客。 我一直对优秀的前端工程师能够将JavaScript和CSS推入多高的水平,以及他们能够熟练掌握复杂的Web浏览器感到惊讶。

Yet I also can't help but notice that a lot of front-end developers seem to limit themselves to, well, the front-end.

但是我也忍不住注意到许多前端开发人员似乎将自己限制在前端。

从前到后 (Front to Back)

On one hand this makes sense. With new JavaScript frameworks and browser versions popping up every day, client-side development already offers more than enough to keep you occupied for a lifetime.

一方面,这是有道理的。 随着每天出现新JavaScript框架和浏览器版本,客户端开发已经提供了足够多的资源,可让您终身受益。

Yet the fact remains that it's often hard to build functional web apps without involving a back-end environment at some point, if only to communicate with a database.

然而,事实仍然是,即使仅与数据库通信,要在某个时候不涉及后端环境的情况下构建功能强大的Web应用程序通常很困难。

Up to now, adding a back-end to your app meant learning a back-end language such as Ruby, Python, or PHP. And that new environment came with its own set of patterns and quirks that had to be learnt from scratch.

到目前为止,在您的应用程序中添加后端意味着学习诸如Ruby,Python或PHP之类的后端语言。 而且,这种新环境带有它自己的一套模式和怪癖,必须从头开始学习。

But things are changing. Node.js introduced JavaScript on the server, and for the first time developers could code their whole app in a single language.

但是情况正在改变。 Node.js在服务器上引入了JavaScript,并且开发人员第一次可以用一种语言编写整个应用程序。

Meanwhile, backend-as-a-service offerings like Parse and Firebase now make it possible to add persistent data to an app with little more than a few lines of JavaScript.

同时,像Parse和Firebase这样的后端即服务产品现在使使用几行JavaScript即可向应用程序添加持久数据成为可能。

But to day I'd like to talk about yet a third approach: Meteor, an up-and-coming JavaScript framework that bridges the gap between client and server.

但是今天,我想谈谈第三种方法: Meteor ,这是一个新兴JavaScript框架,它弥合了客户端和服务器之间的鸿沟。

I discovered Meteor about one year ago, and quickly fell in love. I went on to build a popular open-source app with it, used that app to power a very successful project of mine, and ended up writing a book about it!

大约一年前,我发现了流星,并很快坠入爱河。 我继续使用它构建了一个流行的开源应用程序 ,并使用该应用程序为我的一个非常成功的项目提供了动力,最后写了一本关于它的书 !

Meteor might still be quite new, but I think a lot of front-end engineers and designers would quickly fall in love with Meteor if given the chance.

流星也许还很新,但我认为如果有机会,很多前端工程师和设计师会很快爱上流星。

So here's a quick introduction to Meteor written for people who already live and breathe JavaScript in the browser, but haven't yet crossed over to the "dark side" of server-side JavaScript.

因此,这是Meteor的快速入门文章,是为已经在浏览器中生活和呼吸JavaScript但还没有过渡到服务器端JavaScript的“阴暗面”的人们编写的。

流星? (Meteor?)

Let's start with the basics: Meteor is a JavaScript framework based on Node.js. Unlike most other JS frameworks, Meteor runs both on the server and the client, meaning you can manage your whole app with a single code base, and that both parts can seamlessly talk to each other.

让我们从基础开始:Meteor是一个基于Node.jsJavaScript框架。 与大多数其他JS框架不同,Meteor 既可以在服务器上运行,也可以在客户端上运行,这意味着您可以使用单个代码库来管理整个应用程序,并且这两个部分可以无缝地相互通信。

Meteor's other selling point is that it's fully reactive and real-time, meaning that any data change on the server will get immediately reflected on the client, without any extra work on your part.

Meteor的另一个卖点是完全React性实时性 ,这意味着服务器上的任何数据更改都将立即反映在客户端上,而无需您做任何额外的工作。

In practice, this means you can build single-page JavaScript appextremely fast, since most of the server-client plumbing will be taken care of for you.

实际上,这意味着您可以非常快地构建单页JavaScript,因为大多数服务器-客户端管道都将由您来处理。

您已经知道了大部分 (You Already Know Most Of It)

The reason why I think Meteor is a great match for front-end engineers is that the typical JS coder will already be familiar with a decent chunk of a Meteor app's code, even if they've never laid eyes on the Meteor documentation before.

我认为Meteor非常适合前端工程师的原因是,即使以前的JS编码器以前从未看过Meteor文档,但他们已经熟悉Meteor应用程序代码的相当大的一部分。

Of course, the fact that Meteor uses JavaScript everywhere is a big help: unlike with Rails or Django, you won't have to learn a new programming language.

当然,Meteor到处都使用J​​avaScript的事实是一个很大的帮助:与Rails或Django不同,您不必学习新的编程语言。

What's more, Meteor also makes use of all the libraries you're already familiar with (jQuery, Underscore, Handlebars), and they even come included by default with every new Meteor app (although you're also free to replace them with your favorite alternatives).

而且,Meteor还利用了您已经熟悉的所有库(jQuery,Underscore,Handlebars),并且每个新Meteor应用程序都默认包含了它们(尽管您也可以随意用自己喜欢的库替换它们)备择方案)。

So instead of learning new patterns from scratch, you can simply jump in and put your existing JavaScript knowledge to good use right away.

因此,无需从头开始学习新模式,您只需跳入并立即充分利用现有JavaScript知识即可。

简单设定 (Simple Setup)

One of the big obstacles to crossing the client/server chasm is the need to set up a local development environment.

跨越客户/服务器鸿沟的最大障碍之一是需要建立本地开发环境。

After all, all you really need to handle client-side code is a web browser, and maybe a local instance of Apache if you really want to get fancy.

毕竟,您真正需要处理客户端代码的只是Web浏览器,如果您真的想花哨的话,也许是Apache的本地实例。

On the other hand, setting up most full-stack environments require installing new languages, frameworks, modules, and probably version managers as well.

另一方面,设置大多数全栈环境需要安装新的语言,框架,模块以及可能的版本管理器。

The good news is that Meteor bundles all of that stuff in a single-command super easy install. Just type:

好消息是,Meteor将所有这些东西捆绑在一个命令的超级简单安装中。 只需输入:

curl https://install.meteor.com | /bin/sh

And you'll be good to go. So if you can open a terminal window, you can probably install Meteor.

而且您会很好。 因此,如果您可以打开终端窗口,则可能可以安装Meteor。

集合与React (Collections and Reactivity)

So if you're already familiar with JavaScript and setup is so simple, what do you actually need to learn to build a Meteor app?

所以,如果你已经熟悉JavaScript和设置是如此简单,你什么真正需要学习如何建立一个流星的应用程序?

For me, the two key concepts to understand when starting out with Meteor are Collections and Reactivity.

对我而言,从Meteor开始时要了解的两个关键概念是CollectionsReactivity

Collections are the MongoDB equivalent of SQL tables, i.e. a way to group similar data together. Meteor exposes a powerful API to publish and subscribe to these collections, and this API lets you control which subset of your data to make available to the browser.

集合等效于MongoDB SQL表,即一种将相似数据组合在一起的方法。 Meteor公开了一个强大的API,可以发布和订阅这些集合,而该API则使您可以控制哪些数据子集可供浏览器使用。

For security as well as performance reasons, you probably don't want to send your whole database over to every client! So mastering collections is one of the first steps to building robust Meteor apps.

出于安全性和性能原因,您可能不想将整个数据库发送给每个客户端! 因此,掌握馆藏是构建强大的Meteor应用程序的第一步。

The other key Meteor concept is Reactivity. Simply put, any change to a reactive data source will be immediately reflected anywhere this data source is used in the app.

流星的另一个关键概念是React性。 简而言之,对React式数据源的任何更改都将立即反映在应用中使用该数据源的任何位置。

These data sources include not only the data stored in your database, but also things like Session variables or routing filters. What's more, you can also make any variable of your choosing reactive.

这些数据源不仅包括存储在数据库中的数据,还包括会话变量或路由过滤器之类的东西。 此外,您还可以使选择的任何变量成为React性的。

Reactivity is extremely powerful, and also a little magic. And like most magic, it can sometimes have unintended side effects if you're not careful.

React性非常强大,并且还有一点魔力。 和大多数魔术一样,如果不小心,它有时可能会产生意想不到的副作用。

So there's a bit of a learning curve there, but after mastering these concepts you'll quickly see the rest of the framework fall into place.

因此,这里有一些学习曲线,但是掌握了这些概念后,您将很快看到框架的其余部分。

一个例子 (An Example)

Now that you know what Meteor is all about, let's take a look at a quick example of Meteor code.

既然您已经了解了Meteor的全部含义,那么让我们看一下Meteor代码的快速示例。

Here's the code for two of Microscope's templates (in this case, for user notifications).

这是两个Microscope模板的代码(在这种情况下,用于用户通知)。

Note: in case you're wondering, Microscope is the example social news app that you build throughout our book, Discover Meteor.

注意:如果您想知道,“ 显微镜”是您在我们整本书《 发现流星》中构建的示例社交新闻应用程序。

<template name="notifications">
<ul class="notification">
{{#if notificationCount}}
{{#each notifications}}
{{> notification}}
{{/each}}
{{else}}
<li><span>No Notifications</span></li>
{{/if}}
</ul>
</template>
<template name="notification">
<li>
<a href="{{postPagePath postId}}">
<strong>{{commenterName}}</strong> commented on your post
</a>
</li>
</template>

And here's the accompanying JavaScript code that powers these templates:

这是为这些模板提供动力的随附JavaScript代码:

Template.notifications.helpers({
notifications: function() {
return Notifications.find({userId: Meteor.userId(), read: false});
},
notificationCount: function(){
return Notifications.find({userId: Meteor.userId(), read: false}).count();
}
});
Template.notification.events({
'click a': function() {
Notifications.update(this._id, {$set: {read: true}});
}
})

I'm willing to bet you can already get an idea of what this code does, without having ever laid eyes on a Meteor app before.

我敢打赌,您以前就不会看过Meteor应用,就已经对代码的功能有所了解。

The first code sample contains two handlebars templates. The first notifications template iterates over the notifications, including the notification for each iteration.

第一个代码示例包含两个车把模板。 第一个notifications模板遍历通知,包括每次迭代的notification

The JavaScript code can then simply fill in the blank, by defining the object to be iterated on. In this case, return Notifications.find({userId: Meteor.userId(), read: false}); simply means "return all unread notifications for the current user".

然后,通过定义要迭代的对象,JavaScript代码可以简单地填充空白。 在这种情况下, return Notifications.find({userId: Meteor.userId(), read: false}); 只是意味着“返回当前用户的所有未读通知”。

And of course, this is all reactive, meaning that your list of notifications will be automatically updated as soon as the underlying data changes!

当然,这都是被动的,这意味着您的通知列表将在基础数据更改后自动更新!

If you'd like to learn more, checkout this quick introduction to Meteor templates.

如果您想了解更多信息,请查看此流星模板快速入门 。

为什么不试试呢? (Why Not Give It A Try?)

Now I don't want to make it sound like learning Meteor is a trivial undertaking. It's a new framework that introduces many powerful concepts, and like every new technology it has a learning curve.

现在我不想让听起来像学习流星是一件微不足道的事情。 这是一个新框架,引入了许多强大的概念,并且像每种新技术一样,它都有学习曲线。

But it's not a coincidence is Meteor is getting picked up more and more in hackathons and in education settings: it provides a low-friction environment that makes it easy to get started.

但这并不是巧合,Meteor在黑客马拉松和教育环境中越来越多地被使用:它提供了一种低摩擦的环境,使其易于入门。

So if you have an hour or two ahead of you, I'd suggest you give it a try. After all, if you're looking to learn a server-side development environment, you could do worse that pick one where you'll have a big head start!

因此,如果您要提前一两个小时,建议您尝试一下。 毕竟,如果您想学习一个服务器端开发环境,那么选择一个可以大踏步前进的选择可能会更糟!

获得Discover Meteor 20%的折扣 (Get Discover Meteor 20% Off)

If you're not sure where to get started, our book Discover Meteor can be a great way to quickly get up to speed.

如果您不确定从哪里开始,那么我们的书《发现流星》可能是快速入门的好方法。

In it, you'll learn how to build a real-world, functional web app, including topics such as:

在其中,您将学习如何构建真实的功能性Web应用程序,包括以下主题:

  • How to set up user accounts.如何设置用户帐户。
  • How to set up routing to different templates.如何设置到不同模板的路由。
  • How to manage various data collections.如何管理各种数据收集。
  • How to handle permissions and errors.如何处理权限和错误。
  • How to animate elements in real-time. 如何实时制作元素动画。
  • And much more…以及更多…

What's more, if you use this special URL you'll automatically get 20% off at checkout!

更重要的是,如果您使用这个特殊的URL,您将在结帐时自动获得20%的折扣 !

翻译自: https://davidwalsh.name/meteor-frontend-engineers

前端 流星特效


http://www.taodudu.cc/news/show-3213587.html

相关文章:

  • 从APP角度看复杂表格的交互绘制
  • 麻城理工大学计算机系,填报湖北工业大学计算机专业太TMD难了
  • 桁架机器人立柱_麻城大型桁架式机械手,桁架式机器人结构
  • js之省市区(县)三级联动效果
  • 浠水一中2021年高考成绩查询,黄冈各县市2020高考捷报汇总!看看麻城今年成绩如何!...
  • 微信小程序的开发之城市json数据
  • 省市区sql语句之:(三)区2
  • Python之查询天气小程序
  • 【7】Spring Boot系列之REST Docs
  • Android 之省市县三级联动XML文件
  • 原生js之 省市区三级联动
  • 082-天气预报之城市代码 ID
  • ElementUI自定义组件之地区三级联动
  • 网络之HTTPS
  • 《四方行纪之包头》
  • 麻城县孝感乡之谜
  • 麻城筹资5亿打造智慧城市 建成信息化应用系统
  • 麻城一中2021高考成绩查询,麻城一中隆重举行2021届高考百日誓师大会
  • 2021年麻城一中高考成绩查询,麻城一中2020年高考成绩 麻城一中2020年高考喜报...
  • java 模拟评委打分系统
  • PHP论坛实现积分系统的思路
  • 作业上传+学生互评打分系统
  • 积分商城系统开发
  • 评委打分系统
  • Django项目之打分系统
  • java 打分系统_java学生日常评分管理系统
  • 人脸识别实例-颜值打分系统简易版
  • Java基础进阶-评委打分系统
  • 电商平台的积分系统设计
  • Codeforces积分系统介绍

前端 流星特效_前端工程师流星相关推荐

  1. java和前端哪个好学_前端好学还是Java好学?

    学web前端 首先要了解前端是做什么的,web前端开发工程师,主要职责是利用 html,css,JavaScript,Flash等各种web技术进行客户端产品的开发.完成客户端程序(也就是浏览器端)的 ...

  2. 前端实习生笔试_前端面试实习题目总结:

    以下是部分整理,有时间还会整理出其他的~~ (最近还在找实习呜呜~~) 1.JavaScript是一种弱类型语言,有什么优点和缺点 https://blog.csdn.net/sinolze... ( ...

  3. java后端与前端的交互_前端和后端数据交互的基本知识和常见方式

    一.首先了解前端,后端,数据三者的关系. 1.前端常常是是html,css,js三者的构成的页面的总称.运行在客户端.以浏览器为例. 2.后端常常是后端语言.比如php,java等写的一些脚本.来操作 ...

  4. mysql前端还是后端_前端和后端哪个发展好点?

    前端和后端哪个工资高,哪个发展前景好?事实上,两个都是属于技术研发岗位,都是高薪有前途的职业,不存在说哪个工资更高些,都基本在一万到五万之间,工资的差别主要体现在个人技术上.要问做前端好还是做后端好? ...

  5. 前端命名规范_前端开发工程师如何突破年薪50万?这里有4点建议

    现在越来越多的年轻人选择进入互联网行业,但是千锋广州小编发现同样是一个前端开发的岗位,有的年薪高达50万,有的年薪只有十万,而他们的入行时间差不多,工作的技术体系也差不多,但为什么差距这么大呢? ​要 ...

  6. vue 前端商城框架_前端工程师要掌握几个Vue框架

    vue是一套用于构建用户界面的渐进式JavaScript框架,简单说Vue是类似于view的前端框架. vue开发核心是关注视图层,同时它更加容易与第三方库结合,再者我们在现有的项目中可以直接整合一起 ...

  7. 嵌入式软件工程师是前端还是后端_嵌入式软件工程师与软件工程师的区别

    对于任何一个想在计算机领域内"一通百通"工程师而言,这恐怕是过不去一道思考题. 先从日常工作说起,嵌入式软件工程师每天的工作就是操作一些寄存器或看一些器件的操作的资料,实现一些功能 ...

  8. 前端学习路线_前端学习路线图

    2020年全新前端学习路线图分享给大家! 学习是一个循序渐进的过程,是一件非常难得坚持的事情.如果真的想学习前端开发,一定要下决心! 我这里分享给你的前端学习路线图,希望对你有帮助,以下为2020年更 ...

  9. python开发前端后端区别_前端开发与后端开发有什么区别?

    有些人对前端开发和后端开发还存在着疑惑,其实顾名思义,前端开发就是用户看得见摸得着的东西,而后端更多的是与数据库进行交互以及处理相应的业务逻辑.其实主要区别体现在以下两个方面:知识结构与实现和工作职责 ...

最新文章

  1. scvmm live migration issue
  2. Java中工程、包、类介绍
  3. C#字符串处理(String与StringBuilder)
  4. JavaScript eval() 函数
  5. Javascript基础系列之(五)条件语句(比较操作符)
  6. linux下socket连接下的心跳机制
  7. jQuery 1.3 正式版发布
  8. RHive的安装和用法
  9. 计算机网络基础系列(二)计算机网络体系结构
  10. 360安全浏览器划词翻译_有种遗憾是这些浏览器插件你一个没用过
  11. 浅谈今天所学的Jquery 中的filter()方法
  12. Fusion APP-添加检查软件更新功能
  13. 单独二孩政策对中小城镇居民生育意愿影响实践调查报告(20100字)
  14. 纤亿通带你了解GPON和EPON的区别
  15. 北航2022计算机软件基础期末C++复(预)习
  16. java毕业设计旅游网站设计源码+lw文档+mybatis+系统+mysql数据库+调试
  17. 中国重大铁路事故一览,90年代以前基本都是爆炸事故,90年代以后基本都是追尾事故
  18. 用沾福卡去沾一张花花卡的条件
  19. 【数仓】DAMA数据管理知识体系指南
  20. ffmpeg中的ts/mp4封装格式支持哪些编码格式

热门文章

  1. sql嵌套查询慢的原因
  2. CF EDU138 D(数论) ,牛练104C(DP) ,焦作F. Honeycomb(复杂建图,BFS最短路)
  3. 给自己写一个年终总结,新年快乐!
  4. Android 打开浏览器的几种方法
  5. eclipse+装android+studio,EclipseAndroid Studio安装教程
  6. guess在Java中用法_guess的用法和短语例句
  7. python实验报告实验总结_Python词云制作实验报告
  8. IEC61131, IEC61499图形可视化,PLC图形可视化,PLC组态源代码2018
  9. Webgame是什么?
  10. 模拟退火算法(SA)详解