cross-platform desktop apps with electron (condensed version)

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

Upload: david-neal

Post on 08-Jan-2017

515 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Cross-Platform Desktop Apps with Electron (Condensed Version)

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 (Condensed Version)

Up Ahead

• What is Electron?

• Why desktop?

• Crash course

• Tips

Page 3: Cross-Platform Desktop Apps with Electron (Condensed Version)

.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 (Condensed Version)
Page 5: Cross-Platform Desktop Apps with Electron (Condensed Version)

Electron

Pros:

• HTML + CSS + JavaScript

• Node.js + Chrome

• No deployment dependencies

Page 6: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 7: Cross-Platform Desktop Apps with Electron (Condensed Version)

Electron

Cons:

• HTML + CSS + JavaScript

• Seriously, JavaScript

• Native modules in C/C++

Page 8: Cross-Platform Desktop Apps with Electron (Condensed Version)

History

• Created by GitHub for Atom

• Formerly Atom Shell

• Active since January 2013

Page 9: Cross-Platform Desktop Apps with Electron (Condensed Version)

Electron Features

• Rapid development

• Themes

• Shared code/UI

• Deployment + “silent” updates

• Native UX

Page 10: Cross-Platform Desktop Apps with Electron (Condensed Version)

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 (Condensed Version)

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 (Condensed Version)

Atom

Page 13: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 14: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 15: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 16: Cross-Platform Desktop Apps with Electron (Condensed Version)

Nylas N1

Page 17: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 18: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 19: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 20: Cross-Platform Desktop Apps with Electron (Condensed Version)

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

Page 21: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 22: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 23: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 24: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 25: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 26: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 27: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 28: Cross-Platform Desktop Apps with Electron (Condensed Version)

index.html

Page 29: Cross-Platform Desktop Apps with Electron (Condensed Version)

index.html

Page 30: Cross-Platform Desktop Apps with Electron (Condensed Version)

index.html

Page 31: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 32: Cross-Platform Desktop Apps with Electron (Condensed Version)

main.js

Page 33: Cross-Platform Desktop Apps with Electron (Condensed Version)

There are only 2 hard things in software

development:

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

Page 34: Cross-Platform Desktop Apps with Electron (Condensed Version)

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 35: Cross-Platform Desktop Apps with Electron (Condensed Version)

Process modules

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

Page 36: Cross-Platform Desktop Apps with Electron (Condensed Version)

Render modules

• ipc• remote• web-frame

Page 37: Cross-Platform Desktop Apps with Electron (Condensed Version)

Modules available to both

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

Page 38: Cross-Platform Desktop Apps with Electron (Condensed Version)

Tools

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

Page 39: Cross-Platform Desktop Apps with Electron (Condensed Version)

Boilerplate Projects

• electron-boilerplate

• electron-react-boilerplate

Page 40: Cross-Platform Desktop Apps with Electron (Condensed Version)

photonkit.com

Page 41: Cross-Platform Desktop Apps with Electron (Condensed Version)

MOAR Resources

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

Page 42: Cross-Platform Desktop Apps with Electron (Condensed Version)

Tips

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

Page 43: Cross-Platform Desktop Apps with Electron (Condensed Version)
Page 44: Cross-Platform Desktop Apps with Electron (Condensed Version)

Thank you!

David Neal

@ReverentGeek

[email protected]

reverentgeek.com