

ELECTRON API CODE
Initial development started in 2013 at GitHub to support the hackable text and code editor Atom.
ELECTRON API DRIVERS
Popular apps like Spotify, Visual Studio Code, Atom, GitHub Desktop, and Slack all rely on a JavaScript stack-and even software powerhouses like Adobe’s Creative Suite and the Nvidia Windows Drivers come with Node.js bundled in.Įlectron is an open source framework that allows developers to use web technologies to build desktop applications. If (window.interop) are high that you are already using a desktop app powered by web technologies. What might this look like in code? // =Ĭonst mainWindow = new BrowserWindow( = require('electron') Given this, by far the most straightforward approach would be to treat Electron like a browser, and just spawn a renderer process pointing at your remote web app.
ELECTRON API FULL
The key difference here is that both processes have full access to Node built-ins like require and fs. The main process bootstraps the app and coordinates other processes in the background, while the renderer process is responsible for what the user sees and interacts with, much like a browser tab. It’s important to remember what Electron is, aside from being so hot right now - Electron is Chromium and Node combined into one runtime, which you control by interacting primarily with two processes: the main / browser process, and the renderer process. Turn Back What could possibly go wrong?.You spy an ornate, dazzling goblet, arrayed in jewels and gold, sitting atop a pedestal glinting off in the distance at the very end of the corridor. As your eyes travel along the tiled, immaculate path, you notice that it continues, like a hallway, straight ahead without twist or turn. You scour the perimeter of the labyrinth, searching for the nearest entrance. 🎂 Path 1: The Shortcut Just load your remote web app into Electron, like a browser Photo by Dave Catchpole ( CC BY 2.0) Once you’ve taken some time to consider what capabilities your app couldn’t have as a standard web app, let’s step into this labyrinth. If you’re looking to build some kind of highly customized browser-like app that can visit any arbitrary website, then avert your gaze - Electron isn’t a platform for building browsers, and you’ll avoid a whole lot of pain if you look elsewhere for a solution. You can already develop PWAs as desktop apps today on Windows, and Google has plans to launch this (with cross-platform support) sometime in 2018. If, for example, you’re interested in building a desktop app just to display a website as-is in a dedicated window, a PWA desktop wrapper will be a much more secure alternative. These are all capabilities we can’t currently get through the web platform as it stands today. For Slack, this includes fine-grained control over native notifications, screensharing and video calls, spellchecking and language detection, native app and context menus, and access to exciting new APIs like the Touch Bar and My People. 🤔 Why though?īefore you start running this maze, ask yourself - why are you building a desktop app when you already have a perfectly functional web app? Given the rise of progressive web apps (PWAs) and browsers-as-OSes, it’s worth taking some time to think through what capabilities your app can’t possibly have as a standard web app. In maintaining one of the first Electron apps, we’ve navigated this labyrinth in the quest for a more performant, maintainable, and secure hybrid desktop app, and we’d like to help you avoid some of the pitfalls we’ve found along the way. However, here there be dragons - performance hiccups, security vulnerabilities, and maintainability woes lurk in the shadows, waiting for you to unwittingly take a wrong turn. For this to work, there would have to be some way to get these two pieces, Electron and web, to glue together - to interoperate. This is one of Electron’s most compelling draws - not only can you build a cross-platform desktop app from scratch with the web technologies you know and love, but you can also extend a pre-existing web app with new and powerful capabilities. While it’s no secret that the cross-platform Slack Desktop app is built on Electron, it might be slightly less well known that it’s a hybrid app built around our web app ().
