Cross-Platform Desktop
Apps with Electron
David Neal | reverentgeek.com | @reverentgeek
var trustMe = {
has: ["Beard", "Motorcycle"],
consumes: ["Bacon", "Caffeine"],
sometimesCanComputer: true
};
Up Ahead
• What is Electron?
• Why desktop?
• Crash course
• Tips
.NET + Mono + Xamarin
Pros:
• Shared .NET code base
Cons:
• Xamarin Mac !== Xamarin iOS/Android
• Native UI is hard, yo
• Deployment
• Licensing
Electron
Pros:
• HTML + CSS + JavaScript
• Node.js + Chrome
• No deployment dependencies
Electron
Cons:
• HTML + CSS + JavaScript
• Seriously, JavaScript
• Native modules in C/C++
History
• Created by GitHub for Atom
• Formerly Atom Shell
• Active since January 2013
Electron Features
• Rapid development
• Themes
• Shared code/UI
• Deployment + “silent” updates
• Native UX
Why Desktop Apps?
• Offline
• Printers, devices,
other local
hardware
• On-premises
• Internal, LOB
• Edit local files
• App Store
• Kiosk
• Desktop > Intranet
• Sometimes it “just
feels right”
Desktop App Ideas
• Disconnected data entry
• Editor
• Time management
• Media player
• Email client
• Messaging, collaboration
• Kiosk
• Mapping, route planner
• Social media client
• Calendar
• Bulk media editor
• File management, backup
• Document generation,
reading
• Audio/video conferencing
• Games
Atom
Nylas N1
> npm install electron-prebuilt
> touch main.js
> touch index.html
main.js
main.js
main.js
main.js
main.js
main.js
main.js
index.html
index.html
index.html
main.js
There are only 2 hard
things in software
development:
cache invalidation, naming things,
and off-by-one errors.
There are only 2 hard
things in software
development:
cache invalidation, naming things,
and off-by-one errors.
AND finding the right animated gif!
3
Process modules
• app
• ipc
• dialog
• menu, menu-item
• power-monitor
• tray
Render modules
• ipc
• remote
• web-frame
Modules available to both
• clipboard
• crash-reporter
• native-image
• screen
• shell
Tools
• electron-debug
• electron-connect
• electron-packager
• electron-builder
• electron-updater
• electron-mocha
Boilerplate Projects
• electron-boilerplate
• electron-react-boilerplate
photonkit.com
Building for Windows
• Windows 7/Server 2008 R2 minimum
(https://dev.modern.ie)
• Visual Studio 2013
• Python 2.7
• Node.js
• Git
Building for Mac
• OS X 10.8+
• Xcode 5.1+
• Node.js
• pyobjc (Homebrew)
Building for Linux
• Python 2.7
• Node.js
• Clang 3.4+
• GTK+ & libnotify dev headers
Tips
• Use CSS default cursor
• -webkit-user-drag:none
• -webkit-user-drag:text
• Keep windows open
• Native modules (electron-rebuild)
• IconFly
Roadmap
• Streamline getting started
• Improve platform integrations
• 1.0 early 2016
MOAR Resources
https://github.com/sindresorhus/awesome-electron
Thank you!
David Neal
@ReverentGeek
david@reverentgeek.com
reverentgeek.com
http://bit.ly/codemash2016

Cross-Platform Desktop Apps with Electron

Editor's Notes

  • #6 Native UX: extensions like native file open/save and tray notifications
  • #16 I had a problem, so I used Java. Now I have a problemFactory to tell me how many problems I have.
  • #25 Now I’d like to show you just how easy it is to get started with Electron…
  • #28 App: application lifecycle events, command-line arguments, system/user paths, launch browser windows (renderers) Dialog: File Open/Save, Info and Error Menu: Native app and context menus Power monitor: monitor power state changes
  • #30 Screen: enumerate displays, cursor location, display events Shell: open item with default app, move files to trash, beep()
  • #31 Electron-updater: publish apps/packages through NPM or your own NPM server.
  • #39 Run some experiments Do like PayPay and give it a trial