News for hackers. Stuff that matters.
Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Tuesday May 02, 2017 @08:11AM (#14245674)
Regardless of whether the HTML+JS+CSS stack is good for desktop apps... The one thing that bums me about Electron is that it bundles an entire web runtime with each app, even though a suitable runtime already exists as part of the operating system.

Seriously, WebKit on Mac and Edge on Windows would be just fine for >99% of Electron apps. Using the available web runtime would be a tremendous saving both in build size and memory usage.

Did you know that Chromium contains 25.3 million lines of code? [1] Each Electron app is bundling a separate copy of that enormous codebase in binary form. It's a terrible waste of memory.

It's true that supporting the native web runtimes would be more work for the Electron framework developers, and sometimes would also mean more work for app developers... But most web apps have absolutely no good reason to be tied to Chromium, so for app developers the diversity would actually be beneficial in the long term IMO.

If someone wants to start a project that's like Electron but uses the native runtimes, I'd actually like to contribute some work. Let's call it "Electrino"?

[1] https://twitter.com/worrydream/status/857794605076500480

Re:Ask HN: Do you think Electron is good for building Deskto... by mijoharas on Tuesday May 02, 2017 @08:37AM (#14245826)
For me, I'd just love it if progressive web apps would have a desktop offline install mode that allowed them to deliver notifications, a desktop icon, and a separate window.

I was expecting this to happen after chrome discontinued their "chrome apps", that the underlying tech would come back with progressive web apps, but I haven't seen anything in that space.

I think it would solve the problems with Electron apps (wouldn't have to rebundle the runtime for a massive binary size and massive memory use).

If anyone knows if anything is happening in this space (progressive web app installation for desktop) please let me know.

Re:Ask HN: Do you think Electron is good for building Deskto... by crucialfelix on Tuesday May 02, 2017 @09:49AM (#14246266)
I am looking forward to more PWA and I agree this would replace most use cases for Electron, but not all.

If it's just a web app (network, localStorage etc) then it would be fine. But if you need to read/write to the user's filesystem or need to include other executables then we can't run that in our browser. We don't want a webbrowser to have any possible path to screwing with your filesystem or running executables.

Re:Ask HN: Do you think Electron is good for building Deskto... by gcoda on Tuesday May 02, 2017 @05:48PM (#14250945)
There is a flag for it. I was surprised that my website 'installed' on my Linux PC, created a '.desktop' file and launched in a separate window. It works now, only bug I encountered is asking 'add do desktop' while I already launched it from desktop
Re:Ask HN: Do you think Electron is good for building Deskto... by mijoharas on Tuesday May 02, 2017 @06:29PM (#14251219)
Really? Awesome! What is the flag? I couldn't find it when googling about for information a few weeks ago.

EDIT: Found this: https://mobile.twitter.com/nolanlawson/status/71266809721643...

Re:Ask HN: Do you think Electron is good for building Deskto... by awjr on Tuesday May 02, 2017 @08:21AM (#14245738)
Look at it from a product owner's perspective. I want 100% of users to have the same experience. Electron bundling a web runtime that gives the same experience on each platform is absolutely key to giving them the same experience. There may also be security issues to consider.
Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Tuesday May 02, 2017 @08:42AM (#14245861)
Look at it from the computer owner's perspective. I don't want your experience if it comes with 100+ MB of redundant code.
Re:Ask HN: Do you think Electron is good for building Deskto... by hashkb on Tuesday May 02, 2017 @08:46AM (#14245889)
Isn't that size arbitrary? Downloading and storing a 100mb program takes the same (or less) fraction of your available resources today as downloading and storing a 1mb program in 1995.

Are you short on disk space? Download is too slow? Is this a real problem?

Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Tuesday May 02, 2017 @08:49AM (#14245906)
Download size is relatively harmless; size on disk is an annoyance and a real concern (a lot of laptop users have an SSD in the 128-256 GB range); but memory footprint is the real killer for me. I don't want every little widget to consume hundreds of megs of memory.

In 1995 my computer had 8 or 16 MB memory... Having a 1 MB app running in the background would have been huge. I certainly don't want to go back to that era.

Re:Ask HN: Do you think Electron is good for building Deskto... by Zak on Tuesday May 02, 2017 @09:24AM (#14246115)
Memory footprint is my big issue with this too. Related, I've noticed chat for various projects slowly migrating from IRC to Slack and have the same issue there. What could have been another irssi window taking up an insignificant amount of memory is now a 150Mb Chrome tab.

To make matters worse, memory growth has stagnated. A Macbook Pro today, to give an example has the same maximum RAM (16Gb) it did in 2010. That's zero memory growth in 7 years for a popular developer machine.

Re:Ask HN: Do you think Electron is good for building Deskto... by hashkb on Tuesday May 02, 2017 @10:01AM (#14246355)
Wouldn't regular Chrome have the same issue? Each tab is a full instance... your argument is against Chrome and web apps, not Electron.
Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Tuesday May 02, 2017 @10:24AM (#14246567)
No, it's different.

Each Chrome tab is a process, but they share the same dynamic libraries in memory. Each Electron app is both a process and a separate copy of the dynamic libraries.

If you run half a dozen Electron apps, those redundant libraries will be taking up roughly a gigabyte already.

Re:Ask HN: Do you think Electron is good for building Deskto... by rodorgas on Tuesday May 02, 2017 @10:12AM (#14246438)
Chrome splits itself in various processes and usually each tab has a process. But each process is not a full Chrome instance. There's a huge difference.
Re:Ask HN: Do you think Electron is good for building Deskto... by MrBra on Tuesday May 02, 2017 @03:48PM (#14249911)
Would people give shit if Spotify was 100 Mb?
Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Wednesday May 03, 2017 @03:57AM (#14253821)
if Spotify were the only app using Electron, it wouldn't matter.

But when every utility and menubar widget has its own copy of Electron, the footprint balloons quickly. And people are actually doing those kinds of apps in Electron already!

Re:Ask HN: Do you think Electron is good for building Deskto... by awinder on Tuesday May 02, 2017 @09:42AM (#14246221)
Which product owner? Totally agree with you, but the reason why it's delivered this way right now is a technical implementation detail. Electron could focus on delivering an API that abstracts away differences between runtime engines (as most web frameworks do). I'm sure bundling chrome in is a boon to simplicity inside electron, so maybe the distinction matters within electron, but i'm not sure that distinction should matter for downstream projects...
Re:Ask HN: Do you think Electron is good for building Deskto... by detaro on Tuesday May 02, 2017 @05:51PM (#14250974)
Not wanting your users to have an "experience" that matches their OS IMHO is bad design.
Re:Ask HN: Do you think Electron is good for building Deskto... by nradov on Tuesday May 02, 2017 @11:43AM (#14247304)
That is not a valid thing to want. The experience is supposed to be different on each OS.
Re:Ask HN: Do you think Electron is good for building Deskto... by bkor on Tuesday May 02, 2017 @08:38AM (#14245837)
That web runtime doesn't ensure that people have the same experience. You're still relying on the abstractions of that runtime. Plus that there haven't been any changes to it.
Re:Ask HN: Do you think Electron is good for building Deskto... by hashkb on Tuesday May 02, 2017 @08:48AM (#14245899)
Can you elaborate? Are you saying that Electron apps have portability issues?
Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Tuesday May 02, 2017 @11:08AM (#14246947)
Well, why wait. I made a repo for "Electrino":

https://github.com/pojala/electrino

Sorry, it's totally empty! But I'm hoping to get around to making a Cocoa+WebKit proof-of-concept this week. I guess the starting point would be to implement just enough APIs to be able to run the main.js example from this Electron tutorial:

https://github.com/electron/electron/blob/master/docs/tutori...

Re:Ask HN: Do you think Electron is good for building Deskto... by WorldMaker on Tuesday May 02, 2017 @12:33PM (#14247868)
Another direction might be to extend Cordova to support macOS and Linux. Cordova already supports building UWP for Windows Desktop/Xbox/HoloLens using the native HTML+JS stack. Seems to me like a lot of existing Cordova plugins just need subtle nudges to support macOS in addition to iOS. Then you just need a good Linux solution and you cover all the desktop environments.

Then narrow the few missing desktop-focused APIs that Electron has but Cordova doesn't have good plugins for. (It would also be nice to support more Node-like background processes in Cordova and more Node-native libraries, but you would need to find a good balance that plays well with mobile.)

Re:Ask HN: Do you think Electron is good for building Deskto... by roboguy12 on Tuesday May 02, 2017 @12:42PM (#14247970)
There's also React Native, which can work on macOS (https://github.com/ptmt/react-native-macos). I'm not sure about other operating systems, though.
Re:Ask HN: Do you think Electron is good for building Deskto... by giaour on Tuesday May 02, 2017 @10:55PM (#14252676)
Microsoft has put out an implementation for Windows, too: https://github.com/Microsoft/react-native-windows
Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Wednesday May 03, 2017 @03:40PM (#14259292)
Update on Electrino: implemented minimal APIs to load Electron's "Hello World" example. Code is in the repo.
Re:Ask HN: Do you think Electron is good for building Deskto... by efdee on Tuesday May 02, 2017 @08:21AM (#14245737)
Only having to target a single browser does make life easier for application developers. It's like programming for the web, but without the hassle of cross-browser compatibility.
Re:Ask HN: Do you think Electron is good for building Deskto... by PaulHoule on Tuesday May 02, 2017 @08:18AM (#14245721)
It just astonishes me how big the slack install is. It is like installing the latest video drivers from Nvidia or AMD.
Re:Ask HN: Do you think Electron is good for building Deskto... by scarface74 on Tuesday May 02, 2017 @08:27AM (#14245778)
What's the purpose of the Slack desktop app? What does it do that the web app doesn't?
Re:Ask HN: Do you think Electron is good for building Deskto... by untog on Tuesday May 02, 2017 @08:33AM (#14245807)
Primarily, it sits as its own entry in your task switcher, and can show the number of pending alerts you have. It also uses OS native notifications, though I know that's increasingly possible through the web too.
Re:Ask HN: Do you think Electron is good for building Deskto... by scarface74 on Tuesday May 02, 2017 @08:59AM (#14245954)
When I did use Slack to communicate with remote coworkers. I just kept a tab open - with notifications turned on. Most of the time I was working with three monitors anyway.

Now that I only use Slack to communicate with former coworkers I just keep it on my phone.

Re:Ask HN: Do you think Electron is good for building Deskto... by k__ on Tuesday May 02, 2017 @09:26AM (#14246131)
Isn't this more of a philosophical problem?

Static binding vs dynamic binding?

Bundling everything up so no outside deps are needed vs using everything that is on the system to save space?

Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Tuesday May 02, 2017 @09:36AM (#14246188)
Yes, and I wish developers could make that choice more easily.

The Electron approach is fine for genuinely large applications. But I've seen many Electron-based Mac desktop apps where the UI has a handful of elements. The equivalent Cocoa app would be maybe 100 kB.

I understand that people won't learn Cocoa just for tiny UIs, so it would be really nice if there were a mostly Electron-compatible solution that would use the system web runtime which is already there (and probably already loaded in active memory).

Re:Ask HN: Do you think Electron is good for building Deskto... by k__ on Tuesday May 02, 2017 @10:06AM (#14246388)
It's funny somehow.

They built a framework for, as you say, "genuinely large applications" but it seems to be so easy to use that it's used especially for small ones.

Re:Ask HN: Do you think Electron is good for building Deskto... by bbcbasic on Tuesday May 02, 2017 @05:11PM (#14250639)
And if you are building a large app you'd benefit from a statically typed language with better native data type support than JS.
Re:Ask HN: Do you think Electron is good for building Deskto... by theflork on Tuesday May 02, 2017 @11:27AM (#14247141)
OpenFin claims to have remediated the memory issues of electron somewhat.

https://openfin.co/2016/11/04/openfin-slashes-electron-memor...

Re:Ask HN: Do you think Electron is good for building Deskto... by mmgutz on Tuesday May 02, 2017 @04:45PM (#14250401)
The con is not all browsers support the same features. Sure, we've come along since IE6 and Mozilla but if I'm creating a web-based desktop app, I want to deploy with 100% certainty that the CSS/JS I used works exactly the same when I was developing it.
Re:Ask HN: Do you think Electron is good for building Deskto... by pavlov on Wednesday May 03, 2017 @06:40PM (#14260864)
Update: I decided to build a proof of concept for Electrino. It can run a "Hello world" now.

Here's the Show HN:

https://news.ycombinator.com/item?id=14260755

Re:Ask HN: Do you think Electron is good for building Deskto... by skdotdan on Tuesday May 02, 2017 @11:55AM (#14247437)
Or even Chrome itself.