代码流星雨是什么形式_流星和电子有什么区别?

代码流星雨是什么形式

A lecturer with Electron and Meteor subtly on the board behind him

And which should I learn and use?

我应该学习和使用哪个?

Meteor and Electron are both cross-platform frameworks for developing apps using web languages and technologies such as JavaScript, Node, HTML, and CSS.

MeteorElectron都是用于使用网络语言和技术(例如JavaScript,Node,HTML和CSS)开发应用程序的跨平台框架。

For a while I assumed they did the same things and directly competed with each other. This was based on the language on their own websites. Electron says “Build cross platform desktop apps with JavaScript, HTML, and CSS”. Meteor, on the other hand, says “Meteor is an open source platform for web, mobile, and desktop.”

有一阵子我以为他们做着同样的事情,彼此直接竞争。 这是基于他们自己网站上的语言。 Electron说: “使用JavaScript,HTML和CSS构建跨平台的桌面应用程序” 。 另一方面, Meteor说: “ Meteor是一个用于Web,移动和桌面的开源平台。”

I started researching which is “best” to create a “desktop” app with, and which I should spend time learning. When I tried to find the main differences between them, I was surprised there wasn’t much info comparing the two.

我开始研究哪种方法最适合用来创建“桌面”应用程序,并且应该花时间学习。 当我试图找到它们之间的主要区别时,我感到惊讶的是,没有太多信息可以将两者进行比较。

The confusion is in them both claiming to create “desktop” apps. I don’t know why Meteor claims this, maybe someone can explain?

他们俩都声称要创建“桌面”应用程序,这是一个困惑。 我不知道为什么Meteor这么说,也许有人可以解释?

Let’s go over exactly what each is for.

让我们仔细检查每个对象的用途。

流星 (Meteor)

Meteor logo

Meteor is for building JavaScript apps for web, mobile, and desktop. You use it by installing a program to your operating system and running commands on your projects.

Meteor用于构建适用于Web,移动和桌面JavaScript应用。 通过在操作系统上安装程序并在项目上运行命令来使用它。

It is a full-stack JavaScript platform including the API, build tools, and curated packages from Node.js and the general JavaScript community. Meteor itself includes Node.js, or you can have Node installed locally as well.

它是一个全栈JavaScript平台,包括API,构建工具以及来自Node.js和常规JavaScript社区的精选程序包。 流星本身包含Node.js,或者您也可以在本地安装Node。

To get started with Meteor, head to the website and install the program for your operating system; Windows, Mac, or Linux. You then create an app with meteor create myapp and run meteor which starts a local server for development. If you’d like to know more of the specifics, see the Meteor guide.

要开始使用Meteor,请访问该网站并为您的操作系统安装该程序。 Windows,Mac或Linux。 然后,使用meteor create myapp创建一个应用程序,然后创建meteor create myapp并运行meteor ,这将启动本地服务器进行开发。 如果您想了解更多详细信息,请参阅《 流星指南》

Meteor has a package library called “Atmosphere” which contains libraries specific to Meteor. Some libraries can depend on other Atmosphere libraries. Meteor can also use npm. In the future, it’s likely that all packages will be on npm instead. Completed Meteor apps can themselves also become a library that can be included in other projects.

流星有一个名为“ Atmosphere”的软件包库,其中包含特定于流星的库。 一些库可能依赖于其他Atmosphere库。 流星也可以使用npm。 将来,所有软件包都可能改为使用npm。 已完成的Meteor应用程序本身也可以成为可包含在其他项目中的库。

When the project is ready, you can deploy the app. Since Meteor creates a Node-based app, you need Node hosting. Meteor recommends their own hosting service called Galaxy which is based on Amazon Web Services (AWS).

项目准备就绪后,您可以部署应用程序。 由于Meteor创建了基于节点的应用程序,因此您需要节点托管。 流星推荐他们自己的名为Galaxy的托管服务,该服务基于Amazon Web Services(AWS)。

Many large Meteor apps today are hosted on Galaxy. Using it makes deploying a little easier and there is really nothing to laugh at about being based on AWS. You should be in good hands for scaling your app.

如今,许多大型Meteor应用程序都托管在Galaxy上。 使用它使部署变得容易一些,基于AWS确实没有什么可笑的。 您应该可以轻松扩展应用程序。

Use of Galaxy allows for easier logging, analytics, monitoring, updating and continuous integration, migrating, and staging tools. You don’t have to use Galaxy, but it would be highly recommended, if not just to reduce some complexity in hosting.

使用Galaxy可简化日志记录,分析,监视,更新和持续集成,迁移和登台工具。 您不必使用Galaxy,但是强烈建议您这样做,这不仅是为了降低托管的复杂性。

You can also deploy as an Android or iOS app. This requires some additional setup and tools in your dev environment, but you can add these and run emulators for testing. Meteor for Windows doesn’t support mobile builds. This ability is built on Cordova, which is itself a framework for turning web languages into mobile apps.

您也可以将其部署为Android或iOS应用程序 。 这需要在您的开发环境中进行一些其他设置和工具,但是您可以添加它们并运行仿真器进行测试。 Windows版Meteor不支持移动版本 。 此功能建立在Cordova的基础上,而Cordova本身就是将Web语言转换为移动应用程序的框架。

The big takeaway here is that even though the Meteor website says “Meteor is an open source platform for web, mobile, and desktop”, this does not actually mean it creates desktop apps! This is what confused me at first and perhaps others. Meteor is for creating a “web app”, something that runs on a server and in the browser or iOS or Android app (with appropriate build tools). Meteor is a full stack framework which has both front-end and back-end modules and abilities. Other frameworks such as Ember, for example, are just for the front-end.

这里最大的收获是,即使Meteor网站说“ Meteor是针对Web,移动和桌面的开源平台”,这实际上并不意味着它创建了桌面应用程序! 刚开始时,这就是让我感到困惑的,也许是其他人。 Meteor用于创建“ Web应用程序”,该程序可以在服务器上以及在浏览器或iOS或Android应用程序中运行(使用适当的构建工具)。 Meteor是一个完整的堆栈框架,具有前端和后端模块以及功能。 例如,其他框架(例如Ember)仅用于前端。

Meteor supports integration and use of the most popular JavaScript libraries and frameworks such as Angular and React. It comes ready with deep integration of MongoDB out of the box on the server side, and something called MiniMongo on the client side. Syncing the two DBs is a conversation about pub/sub (publish and subscribe) features. It is extremely easy to create a dataset and begin using it right away almost as easy as creating and using an array.

Meteor支持集成和使用最流行JavaScript库和框架,例如Angular和React。 它已经准备就绪,可以在服务器端实现MongoDB的深度集成,而在客户端端实现名为MiniMongo的集成 。 同步两个数据库是关于发布/订阅(发布和订阅)功能的讨论。 创建数据集并立即开始使用它非常容易,几乎就像创建和使用数组一样容易。

For examples of sites built on Meteor, check out their showcase, or head to BuiltWithMeteor. As one example, here is something of a Trello clone, Kanban board called Wekan.

有关在Meteor上构建的网站的示例,请查看其展示柜 ,或前往BuiltWithMeteor 。 例如,这是Trello克隆的东西,即看板,称为Wekan

电子 (Electron)

Electron logo

Electron is for building cross-platform apps that run as desktop applications. You also program with JavaScript, HTML, CSS and various Node libraries, but it compiles as a native desktop app for Windows, Linux, and Mac. Something that Meteor does not do out of the box.

Electron用于构建作为桌面应用程序运行的跨平台应用程序 。 您还可以使用JavaScript,HTML,CSS和各种Node库进行编程,但是它可以作为Windows,Linux和Mac的本地桌面应用程序进行编译。 流星开箱即用的功能。

Electron was created by Github for their Atom editor, and has since been used by the likes of Microsoft and Facebook.

Electron是由Github为他们的Atom编辑器创建的,此后已被Microsoft和Facebook等公司使用。

The interface container is handled by Chromium and uses a bundled Node.JS server to “serve” the app within the container. It’s a self-contained web server running in a frame that isn’t much different than a tab in a Chrome browser window.

接口容器由Chromium处理,并使用捆绑的Node.JS服务器“服务”容器中的应用程序。 它是一个独立的网络服务器,运行在一个框架中,与Chrome浏览器窗口中的标签没有太大区别。

All the typical tools can be used like React, Angular, and Node libraries. You won’t be running PHP or Ruby or Java in there though!

可以使用所有典型工具,例如React,Angular和Node库。 您将不会在那里运行PHP或Ruby或Java!

Via Chromium, your apps can access certain native OS features like dialog boxes, menus, and notifications. Windows apps can be packaged and deployed using an installer program. You have file system access, and can store data in many different ways.

通过Chromium,您的应用程序可以访问某些本机OS功能,例如对话框,菜单和通知。 Windows应用程序可以使用安装程序打包和部署。 您具有文件系统访问权限,并且可以用许多不同的方式存储数据。

Programs can be built to include self-updating, crash reporting, and profiling/debugging.

程序可以构建为包括自我更新,崩溃报告和性能分析/调试。

If you want to see Electron in action, well you are probably already using it. Many apps run on it, such as Slack, Visual Studio Code, Nylas N1, Brave Browser, and Atom editor. See many more here.

如果您想了解Electron的实际应用,那么您可能已经在使用它了。 许多应用程序都在其上运行,例如Slack,Visual Studio Code,Nylas N1,Brave Browser和Atom编辑器。 在这里看到更多。

Visual Studio Code built in Electron

Compiled apps for Mac need at least version 10.9 64bit. For Windows you need Windows 7 and above and they can work with both 32bit and 64bit but not ARM versions. Linux depends on libraries, but for sure Ubuntu 12.04 (and later), as well as Fedora 21 and Debian 8 are verified to work.

Mac的编译应用程序至少需要版本10.9 64bit。 对于Windows,您需要Windows 7及更高版本,并且它们可以使用32位和64位,但不能使用ARM版本。 Linux依赖于库,但是可以肯定的是Ubuntu 12.04(及更高版本)以及Fedora 21和Debian 8已通过验证。

For storage there are a lot of options. The smallest may be LocalStorage but it’s very small, measured in megabytes. A good “next size up” JSON store (useful for settings and state) is called electron-json-storage. Moving up from there you can look at Pouchdb but some have argued performance suffers after so many thousands of rows, around 50k and up.

对于存储,有很多选择。 最小的可能是LocalStorage,但它很小,以兆字节为单位。 一个好的“ 超大尺寸” JSON存储(可用于设置和状态)称为electron-json-storage 。 从那里往上走,您可以看一下Pouchdb,但有些人认为,经过成千上万行(大约50k或更多)后,性能会下降

Perhaps the largest storage option is IndexedDB which is limited in size to a 3rd of available hard drive space. There are various adapters and APIs for managing IndexedDB such as Dexie.js. You can even find alternative local database stores such as NeDB, inspired from MongoDB.

也许最大的存储选项是IndexedDB,它的大小限制为可用硬盘驱动器空间的三分之一。 有各种用于管理IndexedDB的适配器和API,例如Dexie.js 。 您甚至可以找到受MongoDB启发的其他本地数据库存储,例如NeDB

所以主要的区别是 (So the Main Difference is…)

Electron compiles desktop applications for Windows, Linux, and Mac. Meteor creates a full stack web application and potentially iOS and Android apps via Cordova.

Electron编译Windows,Linux和Mac的桌面应用程序。 流星通过Cordova创建一个全栈Web应用程序以及可能的iOS和Android应用程序。

One obvious question we might ask is: can I create a Meteor app, but run it as an Electron container so I get all the benefits of both?

我们可能会问的一个显而易见的问题是:我可以创建一个Meteor应用程序,但可以将其作为Electron容器运行,从而获得两者的全部好处吗?

The answer is yes.

答案是肯定的。

The caveat is that there doesn’t seem to be a robust, accepted way to do it. There are many methods, as a quick Google search will reveal. The best place to start is the Meteor forums. You may come across Electrometeor, a project for running Meteor in Electron, but commits are a year and two years old. I don’t know if still works with the latest Meteor version (as of this writing, version 1.4).

需要注意的是,似乎没有一种健壮的,公认的方法可以做到这一点。 有多种方法,快速的Google搜索就会显示出来。 最好的起点是流星论坛。 您可能会遇到Electrometeor ,这是一个在Electron中运行Meteor的项目,但是提交工作已经一年又两年了。 我不知道最新的Meteor版本是否仍可以使用(在撰写本文时,版本为1.4)。

Combining the two is definitely on my own bucket list!

结合这两个绝对是我自己的清单!

The end result of combining them is that you have an app that will run on the web, compile to iOS and Android apps, and run on multi-platform desktops. All the different deployments will share a majority of the same code base.

将它们组合在一起的最终结果是,您将拥有一个可在网络上运行,可编译为iOS和Android应用并在多平台桌面上运行的应用。 所有不同的部署将共享大部分相同的代码库。

其他 (The Others)

It goes without saying that there are alternatives to both of these frameworks.

不用说,这两个框架都有替代方案。

Alternatives to Electron are slim, with the main competitor being NW.js, formerly “node-webkit”. They are both based on the V8 Chromium JS engine but Electron does just squeak ahead in features.

Electron的替代产品比较苗条,主要竞争对手是NW.js (以前是“ node-webkit”)。 它们都基于V8 Chromium JS引擎,但是Electron确实在功能方面领先。

There are other ways to package apps for multiple platforms, but Electron is for HTML, JS, CSS, and Node. Xamarin, for example, does the same but using C#.

还有多种方法可以打包适用于多个平台的应用程序,但是Electron适用于HTML,JS,CSS和Node。 例如, Xamarin使用C#进行相同的操作。

The best competition for Meteor is probably going to be Express which is a framework also built for Node.js. Supplementing Express would be Feathers, which adds more modules and features for building real-time apps and rounding out the features of Express.

流星的最佳竞争者可能是Express ,它也是为Node.js构建的框架。 Feathers是Express的补充,它将添加更多模块和功能来构建实时应用程序并完善Express的功能。

The competition is so tight that I would seriously consider researching Meteor against Express and Feathers before making a choice for one or the other. Express has gained a lot of popularity and makes bootstrapping a Node project pretty quick. Feathers adds real time features and many helpful modules to work with Express hand-in-hand.

竞争是如此激烈,以至于我在选择其中一项之前会认真考虑针对Express和Feathers研究Meteor。 Express已经获得了很大的普及,并使得引导一个Node项目很快。 Feathers添加了实时功能和许多有用的模块,以与Express Express携手使用。

结论 (Conclusion)

Use Meteor if you want a local dev tool to create and deploy your JavaScript web app online. Make use of Galaxy hosting and all the tools it provides so your app can scale and be monitored properly, saving on sysadmin chores.

如果要本地开发工具在线创建和部署JavaScript Web应用程序,请使用Meteor。 利用Galaxy托管及其提供的所有工具,以便您的应用可以扩展和正确监控,从而节省了系统管理员的工作量。

Meteor is a framework for developing, testing, profiling, deploying, updating, and monitoring a rich web app. And then with Cordova, you can package it up for phone app stores and deploy to iOS and Android. After that, you can think about packaging the app up with Electron to create a desktop experience on Windows, Mac, and Linux.

Meteor是用于开发,测试,配置文件,部署,更新和监视富Web应用程序的框架。 然后,通过Cordova,您可以将其打包到手机应用商店中,并部署到iOS和Android。 之后,您可以考虑将应用程序与Electron打包在一起,以在Windows,Mac和Linux上创建桌面体验。

Meteor isn’t only for small apps. This fascinating presentation titled “3,000 Hours Into Meteor” on how Qualia built their system on Meteor (with 10s of thousands of pieces of related data and a very data-intensive interface) is worth a watch!

流星不仅适用于小型应用程序。 这个有趣的演讲题为“进入流星3000小时” ,讲述Qualia如何在Meteor上构建其系统(具有数以万计的相关数据和非常密集的数据界面),值得一看!

Use Electron if you’re interested only in creating cross-platform desktop applications that can work offline as well as online, and want to build with web languages like JavaScript, HTML, CSS, Node, and npm libraries. Electron is, at the heart, just a Node server running in a Chromium container with JavaScript V8 engine. Theoretically, you can run any old Node app in there, built with Meteor or otherwise.

如果您仅对创建可脱机和联机使用的跨平台桌面应用程序感兴趣,并希望使用JavaScript,HTML,CSS,Node和npm库之类的Web语言进行构建,请使用Electron。 本质上,Electron只是一个运行在带有JavaScript V8引擎的Chromium容器中的Node服务器。 从理论上讲,您可以在其中运行任何使用Meteor或其他方式构建的旧Node应用程序。

If you build you app firstly with Electron and then want to deploy to the web, you’ll have to deconstruct it to the essential Node project without any Electron API being used. It may be easier to build a web app first, and THEN think about packaging and making use of Electron for deploying to desktops later.

如果先使用Electron构建应用程序,然后再部署到Web,则必须在不使用任何Electron API的情况下将其解构为基本的Node项目。 它可能会更容易建立一个Web应用程序,再想想包装和利用电子供以后部署到桌面。

I hope that helps you decide whether to use Meteor and/or Electron in your next project! I suggest being familiar with both!

我希望这可以帮助您决定在下一个项目中是否使用Meteor和/或Electron! 我建议您对两者都熟悉!

Let us know in the comments if you want to see more articles covering Electron or Meteor specifically.

如果您想查看更多有关电子或流星的文章,请在评论中让我们知道。

翻译自: https://www.sitepoint.com/whats-the-difference-between-meteor-and-electron/

代码流星雨是什么形式

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值