Electron
(introduction to) Electron
What is Electron?
“Electron is a framework for creating native
applications with web technologies like
JavaScript, HTML, and CSS.”
http://electron.atom.io/
Key ideas
* If you can build a website, you can build a desktop app
Key ideas
* If you can build a website, you can build a desktop app
* Cross platform: write your application once and run it in Mac, Windows and Linux
Key ideas
* If you can build a website, you can build a desktop app
* Cross platform: write your application once and run it in Mac, Windows and Linux
* The hard parts made easy
- Simplify packaging, installation and updates
- Support for native menus, notifications and dialogs
- App crash reporting
Key ideas
* If you can build a website, you can build a desktop app
* Cross platform: write your application once and run it in Mac, Windows and Linux
* The hard parts made easy
- Simplify packaging, installation and updates
- Support for native menus, notifications and dialogs
- App crash reporting
* Open source project: maintained by github + active community
History
2013: Github starts Atom project
May 2014: Atom is open sourced (including Atom Shell)
Apr 2015: Atom Shell is named Electron
May 2016: Electron v1.0 is released
Which apps are built using electron?
http://electron.atom.io/apps/
How does Electron work?
main process
Image from: https://medium.com/developers-writing/building-a-desktop-application-with-electron-204203eeb658
node.js, BrowserWindow
dialog, menu, ipc
main process + renderer process
Image from: https://medium.com/developers-writing/building-a-desktop-application-with-electron-204203eeb658
node.js, ipc, DOM
Let’s build our first Electron app!
friday-talk-electron-app/
|-- package.json
|-- main.js
|-- index.html
package.json
{
"name": "friday-talk-electron-app",
"version": "1.0.0",
"main": "main.js"
}
main.js
index.html
electron-prebuilt is a npm module that contains pre-compiled versions of Electron
Install & Execute
> npm install --save electron-prebuilt
update package.json to add start script
"scripts": {
"start": "electron ."
}
electron-prebuilt is a npm module that contains pre-compiled versions of Electron
Install & Execute
> npm install --save electron-prebuilt
update package.json to add start script
"scripts": {
"start": "electron ."
}
electron-prebuilt is a npm module that contains pre-compiled versions of Electron
Install & Execute
> npm start
> npm install --save electron-prebuilt
and...
What else can we do with Electron?
Native menues
main.js
Native dialogs
index.html
index.js
main.js
Native notifications
index.html
Desktop Environment Integration
http://electron.atom.io/docs/tutorial/desktop-environment-integration/
More...
Other Electron modules
● Tray
● Clipboard
● Shell
● CrashReporter
API demos: https://github.com/electron/electron-api-demos
Some final ideas
* You can use any js library for the renderer process (angular, react, jquery, etc.)
* Node modules are available in both (main + renderer process)
* Renderer process does not always need to display a window, it can be used for
background processing
* Follow native look and feel across the app (ex. fonts, cursors, menu options)
* Best practices? Storage? Drawbacks?
Resources
Links
Code examples
https://github.com/virginia-rodriguez/friday-talk-electron-app
Building a desktop application with Electron: A detailed guide on building your very own sound machine
using JavaScript, Node.js and Electron
https://medium.com/developers-writing/building-a-desktop-application-with-electron-204203eeb658
Awesome Electron: Useful resources for creating apps with Electron
https://github.com/sindresorhus/awesome-electron
Photon: The fastest way to build beautiful Electron apps using simple HTML and CSS
http://photonkit.com/
Talks
The New Desktop: Electron, React, & Pixel-Perfect Native-Feeling Experiences by Evan Morikawa
https://www.youtube.com/watch?v=jRPUB-D1Wx0
Electron: Desktop Apps with Web Languages by Jessica Lord
https://www.youtube.com/watch?v=_dkeD3OZ218
Cross-platform desktop apps using Electron by David Neal
https://www.youtube.com/watch?v=zEAoCCBCuLk
Links about packaging and distribution
electron-packager
https://github.com/electron-userland/electron-packager
Distributing Electron apps
http://electron.rocks/distributing-electron-apps/
Mac App Store Submission Guide
http://electron.atom.io/docs/tutorial/mac-app-store-submission-guide/
Thanks :)

Electron