3 ms·
> A typical app today is built on Electron JS Not enough folks seem to realize but you can use each platforms native web control rather than bundling electron.
by hgs3 3y ago
> A typical app today is built on Electron JS
Not enough folks seem to realize but you can use each platforms native web control rather than bundling electron. If you do that your distributed app can be in the kilobytes. This approach also gives you the freedom to use whatever backend programming language / tech stack you want so long as it can communicate with the web view.
- moralestapia 3y agoHow?
- jsheard 3y agoI think Tauri is the most established "like Electron but with the system webview" framework. It supports wiring up native Rust code behind the webview frontend. https://tauri.app https://tauri.app The obvious downside compared to Electron, besides maturity, is you have to test the frontend on multiple browser engines rather than just bundling Chromium everywhere and calling it a day. It uses Microsofts flavor of Chromium on Windows, Apples flavor of WebKit on their platforms, and WebKitGTK on Linux.
- grujicd 3y agoThere's a small problem with Windows, there are no guarantees you'll have Chromium based Edge installed on a system. You'll have to download and install it if not present, and when I looked it was 100+MB. Sure, you don't have to include it in installer, but you have to account for that case.
- jsheard 3y agoI haven't seen it in action but according to the docs their installer will automatically download Chromium Edge if it's not already installed, so the end-user doesn't have to deal with it, and Windows 11 has it out of the box so that case will only trigger on older versions.
- duckmysick 3y agoIsn't that how it works with Windows software that requires Microsoft Visual C++ Redistributables? The installer checks if they are there, downloading the missing ones when needed.
- josephg 3y agoEven tauri’s own benchmarks show it takes thousands of syscalls to bring up a “hello world” app in tauri. This isn’t lean software. Just because the download size is small doesn’t mean the software is fast or efficient.
- hgs3 3y agoYou can create the web control using each platforms native GUI toolkit and setup JS communication yourself OR you can use a lightweight library that does it for you [1] (search this projects README for language "bindings"). [1] https://github.com/webview/webview https://github.com/webview/webview
- grujicd 3y agoYou still need access to native menus, clipboard, dialogs, drag&drop, etc. There are no light multiplatform libraries for that afaik. Either you'll use Electron, which is more or less these services + browser. Or you'll use some of full multiplatform GUIs, which all have their limitations and drawbacks. Potentially you can use hybrid - web control inside one of multiplatform GUIs (if web control is available at all), but you'll have to reimplement some IPC stuff for communicating with web part. That part already exists for Electron. And you'll still have to rely on this multiplatform GUI and deal with its issues. There's also a matter of trust, Electron if nothing else has VS Code, so we all know that production ready application is possible, even if it's not trivial. It's not that clear cut for Avalonia, MAUI, etc.
- hgs3 3y ago> You still need access to native menus, clipboard, dialogs, drag&drop, etc. You don't need a library for these features. Their easy to access through each platforms native API's and if you go the route of creating the webview yourself (no library) it's a moot point as you're interfacing with the OS anyway.
- grujicd 3y agoIs it easy if you have to use 3 separate native APIs for 3 platforms, where presumably you're mostly proficient with just a single one? To paraphrase Churchill, Electron is the worst multiplatform GUI solution, except for all the others that have been tried.
- edflsafoiewq 3y ago"Lean software" doesn't just mean download size.
- hgs3 3y agoWith the native web control approach you can write the bulk of your app in whatever efficient programming language / tech stack you want (Rust, C, C++, Go, whatever). The webview need only be for presentation - the 'V' in MVC. You aren't stuck with Node.js.
- petabyt 3y agoAnd the app takes several seconds to start up, it's slow, and ends up using more RAM than electron because the user isn't using the native webview as their main browser.
- whartung 3y agoWhat are the current gaps for PWA? PWA should be viable for a pretty large percentage of applications nowadays, right? I don't know, but could Discord be a PWA instead of an Electron app? The biggest gap is something capable like SQLite vs IndexedDB, but even then I bet most apps wouldn't require the sophistication of a higher level query language compared the "b-tree" model of IndexedDB.
- whstl 3y agoA database is a minor obstacle. Most Electron apps I come across mostly use cloud storage, or even require some form of login for no reason other than spying on me (Postman).