JavaScript conquered the Web. Now it’s taking over the desktop

Ngoc Huynh

JAVASCRIPT WAS ORIGINALLY created in 1995 to give web pages a little more pep than the <blink> tag could provide. Today it has far more powerful uses. Companies like Google and Facebook build complex, desktop-like web applications with JavaScript; since the launch of Node.js in 2009, it’s also become one of the most popular languages for building server-side software. Today, even the web isn’t big enough to contain JavaScript’s versatility: it’s now making its way into applications for the desktop.

Electron is a software development platform created by Github that lets developers use JavaScript along with other web technologies like HTML and CSS to create desktop applications that can run on Windows, Macintosh OS X, and Linux. The company released the first full version of Electron yesterday. But some of tech’s biggest names have already put the tool to work to push JavaScript beyond the browser.

Last year, Microsoft released a code editor called Visual Studio Code that was built using Electron. Workplace chat unicorn Slack uses Electron to build its desktop client. The startup Nylas (formerly known as Inbox) used Electron to build an entire email client. And Brave, a company founded by JavaScript creator Brendan Eich, used Electron to build a whole new web browser.

Why are all these companies using JavaScript when there are countless other ways to build desktop applications? Well, consider the rise of JavaScript on the server. Developers already had scores of ways to build server-side web applications when Node.js came along. But it became enormously popular anyway because developers could now use the same language to write both the browser-side and server-side portions of their apps. It turns out it’s useful to have a lingua franca for the web. And that ubiquity makes JavaScript’s migration to the desktop a natural next step.

Open to Everyone

Many of the companies using Electron are building open source software, which means the code is available to anyone to examine and modify. And the more people who understand your open source code, the more people who can contribute bug fixes and new features to the original project. By using JavaScript, these companies are opening the gates to web developers who already know the language but aren’t familiar with more traditional desktop programming languages like C++.

The startup Jibo, for example, is using Electron to power its robotic personal assistant because the team wanted to make it easy for third-party developers to write their own software for the robot. “We wanted to make the barrier to entry as low as possible,” says Jibo developer Jonathan Ross. “So we knew right off the bat that we wanted to market to game developers and web developers.”

That’s a big part of why Electron was created in the first place. Electron was originally built as a platform for developing Atom, a text editor created by GitHub. As GitHub co-founder Chris Wanstrath told WIRED last year, he wanted to build a text editor using JavaScript so that web developers could customize it as they saw fit. “It’s one thing for me to be able to hack my editor,” Wanstrath says. “But what’s way more powerful is that I can use other plug-ins that other people have written.”

Sure, running applications in what amounts to a web browser has its downside. “There is a pretty substantial overhead that comes with running something as an Electron app,” says Ben Gotow, who leads front-end development at Nylas. But the trade-offs are worth it, because Electron does more than just offer the ability to use a popular language. Creating desktop apps in JavaScript lets developers choose from a vast range of freely available code libraries and frameworks, which takes much of the grunt work out of coding. Instead of having to create a login system from scratch, for example, Electron developers can turn to one of many open source authentication libraries online.

“We were able to write a fairly substantial email client in only a year, that’s pretty incredible,” Gotow says.

Geeking Out on JavaScript

The idea of using web technologies to build desktop apps is not new. Adobe’s AIR system enabled developers to build desktop applications using the company’s Flash platform, and a smaller company called Appcelerator, now more focused on mobile app development, once offered tools for building desktop apps with HTML and JavaScript. More recently, a team of developers created NW.js, formerly known as Node Webkit.

But in 2014, the GitHub team found all the available options lacking, so they did what geeks do: they created their own and released it to the whole world. “We thought making good apps should be accessible to anyone,” says GitHub VP of product Kakul Srivastava.

Jessica Lord, who works on Electron at GitHub, says it’s more efficient than what came before it. Electron comes bundled Chromium–the open source version of Google’s Chrome browser—but uses a stripped down version. That makes it easier for the team to integrate new features from Google, since they don’t have to test every single part of every new version of Chromium to see if it breaks an Electron feature.

GitHub’s efforts appear to be paying off. The number of contributors to Electron has grown to more than 300 since the project launched two years ago. And it’s already been downloaded more than one million times. But the competition is growing. NW.js is still being improved, and Facebook has released its own JavaScript framework called React Native that developers can use to build apps for a wide variety of platforms, including Windows, Xbox, iOS, and Android.

Regardless of what framework or platform developers wind up using, JavaScript has clearly found a home on the desktop. For users, the divide between online and offline blurred a long time ago. Now the same is true for the code itself.

Share the news now

Source : http://www.wired.com/