Top Banner
Cross-Platform Desktop Apps with Electron David Neal | reverentgeek.com | @reverentgeek var trustMe = { has: ["Beard", "Motorcycle"], consumes: ["Bacon", "Caffeine"], sometimesCanComputer: true };
50

Cross-Platform Desktop Apps with Electron

Jan 08, 2017

Download

Technology

David Neal
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Cross-Platform Desktop Apps with Electron

Cross-Platform Desktop Apps with Electron

David Neal | reverentgeek.com | @reverentgeek

var trustMe = {has: ["Beard", "Motorcycle"],consumes: ["Bacon", "Caffeine"],sometimesCanComputer: true

};

Page 2: Cross-Platform Desktop Apps with Electron

Up Ahead

• What is Electron?

• Why desktop?

• Crash course

• Tips

Page 3: Cross-Platform Desktop Apps with Electron

.NET + Mono + Xamarin

Pros:• Shared .NET code base

Cons:• Xamarin Mac !== Xamarin iOS/Android

• Native UI is hard, yo• Deployment• Licensing

Page 4: Cross-Platform Desktop Apps with Electron
Page 5: Cross-Platform Desktop Apps with Electron

Electron

Pros:

• HTML + CSS + JavaScript

• Node.js + Chrome

• No deployment dependencies

Page 6: Cross-Platform Desktop Apps with Electron
Page 7: Cross-Platform Desktop Apps with Electron

Electron

Cons:

• HTML + CSS + JavaScript

• Seriously, JavaScript

• Native modules in C/C++

Page 8: Cross-Platform Desktop Apps with Electron

History

• Created by GitHub for Atom

• Formerly Atom Shell

• Active since January 2013

Page 9: Cross-Platform Desktop Apps with Electron

Electron Features

• Rapid development

• Themes

• Shared code/UI

• Deployment + “silent” updates

• Native UX

Page 10: Cross-Platform Desktop Apps with Electron

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”

Page 11: Cross-Platform Desktop Apps with Electron

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

Page 12: Cross-Platform Desktop Apps with Electron

Atom

Page 13: Cross-Platform Desktop Apps with Electron
Page 14: Cross-Platform Desktop Apps with Electron
Page 15: Cross-Platform Desktop Apps with Electron
Page 16: Cross-Platform Desktop Apps with Electron

Nylas N1

Page 17: Cross-Platform Desktop Apps with Electron
Page 18: Cross-Platform Desktop Apps with Electron
Page 19: Cross-Platform Desktop Apps with Electron
Page 20: Cross-Platform Desktop Apps with Electron

> npm install electron-prebuilt> touch main.js> touch index.html

Page 21: Cross-Platform Desktop Apps with Electron

main.js

Page 22: Cross-Platform Desktop Apps with Electron

main.js

Page 23: Cross-Platform Desktop Apps with Electron

main.js

Page 24: Cross-Platform Desktop Apps with Electron

main.js

Page 25: Cross-Platform Desktop Apps with Electron

main.js

Page 26: Cross-Platform Desktop Apps with Electron

main.js

Page 27: Cross-Platform Desktop Apps with Electron

main.js

Page 28: Cross-Platform Desktop Apps with Electron

index.html

Page 29: Cross-Platform Desktop Apps with Electron

index.html

Page 30: Cross-Platform Desktop Apps with Electron

index.html

Page 31: Cross-Platform Desktop Apps with Electron

main.js

Page 32: Cross-Platform Desktop Apps with Electron

There are only 2 hard things in software

development:

cache invalidation, naming things, and off-by-one errors.

Page 33: Cross-Platform Desktop Apps with Electron

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

Page 34: Cross-Platform Desktop Apps with Electron
Page 35: Cross-Platform Desktop Apps with Electron
Page 36: Cross-Platform Desktop Apps with Electron
Page 37: Cross-Platform Desktop Apps with Electron

Process modules

• app• ipc• dialog• menu, menu-item• power-monitor• tray

Page 38: Cross-Platform Desktop Apps with Electron

Render modules

• ipc• remote• web-frame

Page 39: Cross-Platform Desktop Apps with Electron

Modules available to both

• clipboard• crash-reporter• native-image• screen• shell

Page 40: Cross-Platform Desktop Apps with Electron

Tools

• electron-debug• electron-connect• electron-packager• electron-builder• electron-updater• electron-mocha

Page 41: Cross-Platform Desktop Apps with Electron

Boilerplate Projects

• electron-boilerplate

• electron-react-boilerplate

Page 42: Cross-Platform Desktop Apps with Electron

photonkit.com

Page 43: Cross-Platform Desktop Apps with Electron

Building for Windows

• Windows 7/Server 2008 R2 minimum (https://dev.modern.ie)

• Visual Studio 2013• Python 2.7• Node.js• Git

Page 44: Cross-Platform Desktop Apps with Electron

Building for Mac

• OS X 10.8+

• Xcode 5.1+

• Node.js

• pyobjc (Homebrew)

Page 45: Cross-Platform Desktop Apps with Electron

Building for Linux

• Python 2.7

• Node.js

• Clang 3.4+

• GTK+ & libnotify dev headers

Page 46: Cross-Platform Desktop Apps with Electron

Tips

• Use CSS default cursor• -webkit-user-drag:none• -webkit-user-drag:text• Keep windows open• Native modules (electron-rebuild)• IconFly

Page 47: Cross-Platform Desktop Apps with Electron

Roadmap

• Streamline getting started

• Improve platform integrations

• 1.0 early 2016

Page 48: Cross-Platform Desktop Apps with Electron

MOAR Resources

https://github.com/sindresorhus/awesome-electron

Page 49: Cross-Platform Desktop Apps with Electron
Page 50: Cross-Platform Desktop Apps with Electron

Thank you!

David Neal

@ReverentGeek

[email protected]

reverentgeek.com

http://bit.ly/codemash2016