应用程序字体变小_什么是电子应用程序,为什么它们变得如此普遍?

应用程序字体变小_什么是电子应用程序,为什么它们变得如此普遍?

应用程序字体变小

应用程序字体变小_什么是电子应用程序,为什么它们变得如此普遍?

Have you noticed a lot of new desktop applications look pretty much like websites? It’s not your imagination.

您是否注意到很多新的桌面应用程序看起来很像网站? 这不是你的想象力。

From Trello to Slack, from WordPress.com to Github, it’s become increasingly common for so-called desktop applications to bundle a website with a few native features like notifications, file system access, and menus. The most common technology enabling this is called Electron, and it’s used by a few applications you might not even suspect, like chat application Discord and Microsoft’s Visual Studio Code.

从Trello到Slack,从WordPress.com到Github,所谓的桌面应用程序越来越多地将网站与一些本机功能捆绑在一起,例如通知,文件系统访问和菜单。 支持此功能的最常见技术称为Electron ,它甚至被一些您甚至不会怀疑的应用程序使用,例如聊天应用程序Discord和Microsoft的Visual Studio Code

Electron makes it easy for developers to release an app simultaneously on Windows, macOS, and Linux, but there are downsides for users. Electron applications are huge, for one thing. Slack, a chat application, takes up 237 MB of hard drive space on my Mac, and memory consumption isn’t low either. What’s taking up all those resources? And why are developers using something so inefficient?

Electron使开发人员可以轻松地同时在Windows,macOS和Linux上发布应用程序,但对于用户来说也有缺点。 电子的应用是巨大的,一方面。 Slack是一个聊天应用程序,它在Mac上占用237 MB的硬盘空间,并且内存消耗也不低。 什么占用了所有这些资源? 为什么开发人员使用的效率如此低下?

电子应用程序非常容易制作 (Electron Apps Are Pretty Easy to Make)

应用程序字体变小_什么是电子应用程序,为什么它们变得如此普遍?

Desktop applications are hard to make, especially if you want them to be cross-platform. Accessing the file system works differently in Windows than it does in Linux, for example, and notifications work differently on macOS than in Windows. This means anyone who wants to write an application for all three desktop operating systems (or even two of them) needs to re-write a lot of their code when porting from one to another.

桌面应用程序很难制作,尤其是如果您希望它们是跨平台的。 例如,在Windows中访问文件系统与在Linux中访问文件系统的工作方式不同,在macOS上与在Windows中访问通知的方式也不同。 这意味着任何想为所有三个桌面操作系统(甚至其中两个)编写应用程序的人在从一个移植到另一个时都需要重新编写许多代码。

Electron “solves” this by offering a single platform that works on all three major desktop operating systems. This means developers can write the code for things like notifications once and expect it to work natively on every operating system. Even better for developers: everything can be built using Javascript, HTML, and CSS—technologies anyone who codes for the web are very familiar with.

Electron通过提供可在所有三个主要桌面操作系统上运行的单一平台来“解决”这一问题。 这意味着开发人员可以为诸如通知之类的内容编写一次代码,并期望其在每个操作系统上都能正常工作。 对开发人员来说甚至更好:可以使用Javascript,HTML和CSS来构建所有内容,任何为Web编写代码的技术都非常熟悉。

电子应用程序附带了几乎所有的Chrome (Electron Apps Come With Pretty Much All of Chromium)

How is this possible? In part because every Electron app bundles a complete web browser: Chromium, the open source version of Google Chrome. This is bundled along with the platform-specific instructions in order to ensure that everything behaves exactly as developers expect on all systems. That’s why the desktop version of Slack takes up over 200MB of hard drive space: most of Chrome is bundled in there.

这怎么可能? 部分原因是每个Electron应用程序都捆绑了一个完整的Web浏览器:Chromium, Google Chrome的开源版本 。 它与特定于平台的说明捆绑在一起,以确保一切行为均与开发人员在所有系统上期望的完全一样。 这就是台式机版本的Slack占用200MB硬盘空间的原因:大多数Chrome都捆绑在其中。

应用程序字体变小_什么是电子应用程序,为什么它们变得如此普遍?

Every Electron app you run is more or less a full instance of Chrome. As blogger Joseph Gentle pointed out, this is hardly ideal:

您运行的每个Electron应用或多或少都是Chrome的完整实例。 正如博客作者Joseph Gentle 指出的那样 ,这并不理想:

You can think of Slack as a small javascript program running inside another operating system VM (chrome), that you have to run in order to essentially chat on IRC. Even if you’ve got the real chrome open, each electron app runs its own, extra copy of the whole VM.

您可以将Slack视为运行在另一个操作系统VM(chrome)中的小型javascript程序,必须运行才能基本在IRC上聊天。 即使您打开了真正的Chrome,每个电子应用程序也会运行自己的整个VM的额外副本。

So yeah, there are downsides for users. First of all, every single Electron application you download bundles most of Chromium, and every application you run is executing a good chunk of that code. There’s no sharing of resources here like there is with native applications, meaning Electron apps are going to take up more hard drive space and memory than an application developed with your platform specifically in mind. If performance is something you really care about, you might want to avoid Electron applications.

是的,用户也有缺点。 首先,您下载的每个Electron应用程序都捆绑了大部分Chromium,并且您运行的每个应用程序都在执行该代码中的很大一部分。 这里没有像本机应用程序那样共享资源,这意味着与专门为您的平台开发的应用程序相比,Electron应用程序将占用更多的硬盘空间和内存。 如果您真正关心性能,则可能要避免使用Electron应用程序。

等一下,电子好还是坏? (Wait, So Is Electron Good or Bad?)

应用程序字体变小_什么是电子应用程序,为什么它们变得如此普遍?

At this point, computers are so powerful that most users will never even notice how inefficient Electron applications are. In fact, the vast majority have never even heard of Electron. Most of my co-workers hadn’t, and they all use Slack every day. Many were excited to see a desktop version of Trello come out, and again had no idea it was an Electron app.

在这一点上,计算机是如此强大,以至于大多数用户甚至都不会注意到低效率的Electron应用程序。 实际上,绝大多数人甚至从未听说过电子。 我的大多数同事都没有,他们每天都使用Slack。 许多人很高兴看到Trello的桌面版本问世,并且再次不知道这是一个Electron应用程序。

And these apps really do integrate better with your operating system better than websites. They live in their own window. They offer great keyboard shortcuts, native notifications, and other things you can’t do the same way with just a browser.

与网站相比,这些应用程序确实确实可以更好地与您的操作系统集成。 他们住在自己的窗户里。 它们提供了出色的键盘快捷键,本机通知以及其他您仅使用浏览器无法完成的其他操作。

And It’s a good bet that applications like Slack, Trello, and WordPress.com wouldn’t bother to offer a desktop version if Electron didn’t exist, focusing instead on mobile and browser versions. So the question isn’t whether Electron is bad; it’s whether Electron applications are better than nothing. I’m willing to say yes, but reasonable people can disagree. (And hey, for those people, there’s always the web version.)

可以肯定的是,如果不存在Electron,那么诸如Slack,Trello和WordPress.com之类的应用程序就不会费心提供桌面版本,而将重点放在移动和浏览器版本上。 因此,问题不在于电子是否有害;而是电子是否有害。 电子应用是否总比没有好。 我愿意说是,但是理性的人可以不同意。 (嘿,对于那些人,总是有网络版本。)

翻译自: https://www.howtogeek.com/330493/what-are-electron-apps-and-why-have-they-become-so-common/

应用程序字体变小