Cross-Platform Desktop Apps with Electron (JSConf UY)

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

Transcript of Cross-Platform Desktop Apps with Electron (JSConf UY)

Page 1: Cross-Platform Desktop Apps with Electron (JSConf UY)

Cross-Platform Desktop Apps with Electron

David Neal | reverentgeek.com | @reverentgeek

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

};

Page 2: Cross-Platform Desktop Apps with Electron (JSConf UY)

Up Ahead

• What is Electron?

• Why desktop?

• Crash course

• Tips

Page 3: Cross-Platform Desktop Apps with Electron (JSConf UY)

.NET + Mono + Xamarin

Pros:• Shared .NET code base

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

• Native UI• Deployment• Licensing

Page 4: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 5: Cross-Platform Desktop Apps with Electron (JSConf UY)

Electron

Pros:

• HTML + CSS + JavaScript

• Node.js + Chrome

• No deployment dependencies

Page 6: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 7: Cross-Platform Desktop Apps with Electron (JSConf UY)

Electron

Cons:

• HTML + CSS + JavaScript

• Seriously, JavaScript

• Decisions, Decisions

Page 8: Cross-Platform Desktop Apps with Electron (JSConf UY)

Electron

• Created by GitHub for Atom

• Formerly Atom Shell

• Active since January 2013

Page 9: Cross-Platform Desktop Apps with Electron (JSConf UY)

Electron Features

• Rapid development

• Themes

• Shared code/UI

• Deployment + “silent” updates

• Native UX

Page 10: Cross-Platform Desktop Apps with Electron (JSConf UY)

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 (JSConf UY)

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 (JSConf UY)

Atom

Page 13: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 14: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 15: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 16: Cross-Platform Desktop Apps with Electron (JSConf UY)

Nylas N1

Page 17: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 18: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 19: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 20: Cross-Platform Desktop Apps with Electron (JSConf UY)

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

Page 21: Cross-Platform Desktop Apps with Electron (JSConf UY)

( main.js )

Page 22: Cross-Platform Desktop Apps with Electron (JSConf UY)

( main.js )

Page 23: Cross-Platform Desktop Apps with Electron (JSConf UY)

( main.js )

( index.html )

Page 24: Cross-Platform Desktop Apps with Electron (JSConf UY)

( main.js )

( home.html )( editor.html )( settings.html )

Page 25: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 26: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 27: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 28: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 29: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 30: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 31: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 32: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 33: Cross-Platform Desktop Apps with Electron (JSConf UY)

index.html

Page 34: Cross-Platform Desktop Apps with Electron (JSConf UY)

index.html

> electron main.js

Page 35: Cross-Platform Desktop Apps with Electron (JSConf UY)

index.html

Page 36: Cross-Platform Desktop Apps with Electron (JSConf UY)

index.html

Page 37: Cross-Platform Desktop Apps with Electron (JSConf UY)

index.html

Page 38: Cross-Platform Desktop Apps with Electron (JSConf UY)

index.html

Page 39: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 40: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 41: Cross-Platform Desktop Apps with Electron (JSConf UY)

main.js

Page 42: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 43: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 44: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 45: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 46: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 47: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 48: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 49: Cross-Platform Desktop Apps with Electron (JSConf UY)

Process modules

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

• tray

Page 50: Cross-Platform Desktop Apps with Electron (JSConf UY)

Renderer modules

• ipc

• remote

• web-frame

Page 51: Cross-Platform Desktop Apps with Electron (JSConf UY)

Modules available to both

• clipboard

• crash-reporter

• native-image

• screen

• shell

Page 52: Cross-Platform Desktop Apps with Electron (JSConf UY)

Recommended Tools

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

Page 53: Cross-Platform Desktop Apps with Electron (JSConf UY)

Boilerplate Projects

• electron-boilerplate

• electron-react-boilerplate

Page 54: Cross-Platform Desktop Apps with Electron (JSConf UY)

electron-prebuilt-compile

• ES6/ES7 (Babel), TypeScript, CoffeeScript

• React.js

• LESS• Jade• CSON

Page 55: Cross-Platform Desktop Apps with Electron (JSConf UY)

photonkit.com

Page 56: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 57: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 58: Cross-Platform Desktop Apps with Electron (JSConf UY)

Tips

• Use CSS default cursor

• -webkit-user-drag:none• -webkit-user-drag:text• Keep windows open

Page 59: Cross-Platform Desktop Apps with Electron (JSConf UY)

Resources

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

Pluralsight Course: Rob Conery’s “Electron Playbook”

Page 60: Cross-Platform Desktop Apps with Electron (JSConf UY)
Page 61: Cross-Platform Desktop Apps with Electron (JSConf UY)

Thank you!

David Neal

@ReverentGeek

[email protected]

reverentgeek.com