Slide 1

Slide 1 text

The Age of the Javascript-Powered Desktop Evan Morikawa | @e0m | [email protected] Dino JS | June 24, 2016

Slide 2

Slide 2 text

The Precambrian Eon 1.3 billion seconds ago

Slide 3

Slide 3 text

The Precambrian Eon C | C++ Swing | Qt | Cocoa | GTK | WPF/WinRT | … 1.3 billion seconds ago

Slide 4

Slide 4 text

The Paleozoic Era 145 million seconds ago

Slide 5

Slide 5 text

The Paleozoic Era NW.js (Node Webkit) 145 million seconds ago

Slide 6

Slide 6 text

The Mesozoic Era 52 million seconds ago

Slide 7

Slide 7 text

The Mesozoic Era Shell hangouts.google.com/hangouts/_/nylas.com/code-challenge 52 million seconds ago

Slide 8

Slide 8 text

The Cenozoic Era 36 million seconds ago

Slide 9

Slide 9 text

The Cenozoic Era 36 million seconds ago

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Chromium

Slide 14

Slide 14 text

Chromium Browser aka Backend aka Main Process

Slide 15

Slide 15 text

Chromium Browser aka Backend aka Main Process C++

Slide 16

Slide 16 text

Chromium Browser aka Backend aka Main Process C++ Renderer Renderer Renderer HTML / JS (DOM) HTML / JS (DOM) HTML / JS (DOM)

Slide 17

Slide 17 text

Chromium Browser aka Backend aka Main Process C++ Renderer Renderer Renderer HTML / JS (DOM) HTML / JS (DOM) HTML / JS (DOM) ipc

Slide 18

Slide 18 text

Browser aka Backend aka Main Process Renderer Renderer Renderer HTML / JS (DOM) HTML / JS (DOM) HTML / JS (DOM) ipc

Slide 19

Slide 19 text

Node Event Loop libuv Node & Chromium Mashup

Slide 20

Slide 20 text

Chromium Events MessageLoop Chromium Node & Chromium Mashup

Slide 21

Slide 21 text

Chromium Events MessageLoop Chromium Node Event Loop libuv ? Node & Chromium Mashup

Slide 22

Slide 22 text

Chromium Events libuv Chromium Node & Chromium Mashup

Slide 23

Slide 23 text

Chromium Events MessageLoop Chromium Node Event Loop libuv Node & Chromium Mashup

Slide 24

Slide 24 text

Node Event Loop libuv Chromium Events MessageLoop Chromium IO poll Node & Chromium Mashup

Slide 25

Slide 25 text

Browser aka Backend aka Main Process Renderer Renderer Renderer HTML / JS (DOM) HTML / JS (DOM) HTML / JS (DOM) ipc

Slide 26

Slide 26 text

Nylas N1

Slide 27

Slide 27 text

Nylas N1 main.js

Slide 28

Slide 28 text

Nylas N1 main.js const win = new BrowserWindow() win.loadURL(`file://index.html`) win.show()

Slide 29

Slide 29 text

Nylas N1 main.js const win = new BrowserWindow() win.loadURL(`file://index.html`) win.show()

Slide 30

Slide 30 text

Nylas N1 main.js const win = new BrowserWindow() win.loadURL(`file://index.html`) win.show() index.html index.js

Slide 31

Slide 31 text

Nylas N1 main.js const win = new BrowserWindow() win.loadURL(`file://index.html`) win.show() index.html index.js React.render()

Slide 32

Slide 32 text

Nylas N1 main.js const win = new BrowserWindow() win.loadURL(`file://index.html`) win.show() index.html index.js React.render()

Slide 33

Slide 33 text

Nylas N1 main.js const win = new BrowserWindow() win.loadURL(`file://index.html`) win.show() index.html index.js React.render() Composer Work Window

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility

Slide 36

Slide 36 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail

Slide 39

Slide 39 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail

Slide 40

Slide 40 text

Native Electron Extensions npm install sqlite3 electron/electron-rebuild

Slide 41

Slide 41 text

electron/electron-rebuild Native Electron Extensions

Slide 42

Slide 42 text

electron/electron-rebuild node-gyp install --target=${electronVersion} --arch=x64 --dist-url=https://atom.io/download/atom-shell Native Electron Extensions

Slide 43

Slide 43 text

electron/electron-rebuild node-gyp install --target=${electronVersion} --arch=x64 --dist-url=https://atom.io/download/atom-shell npm rebuild --target=${electronVersion} --arch=x64 --runtime=electron Native Electron Extensions

Slide 44

Slide 44 text

nodejs/node-gyp Native Electron Extensions

Slide 45

Slide 45 text

nodejs/node-gyp  gyp (Generate Your Projects) make, gcc, XCode, Visual Studio Native Electron Extensions

Slide 46

Slide 46 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows

Slide 47

Slide 47 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows Jankbusting | Worker Windows

Slide 51

Slide 51 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows Jankbusting | Worker Windows

Slide 52

Slide 52 text

ReactiveX.js

Slide 53

Slide 53 text

const q = `SELECT * FROM threads WHERE dinosaur…` Rx.Observable.fromQuery(q).subscribe((threads) => { this.setState({threads}) })

Slide 54

Slide 54 text

const q = `SELECT * FROM threads WHERE dinosaur…` Rx.Observable.fromQuery(q) .filter(myFn).subscribe((threads) => { this.setState({threads}) })

Slide 55

Slide 55 text

const q = `SELECT * FROM threads WHERE dinosaur…` Rx.Observable.fromQuery(q) .filter(myFn) .map(mapFn).subscribe((threads) => { this.setState({threads}) })

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

SELECT * FROM threads WHERE account_id=123 SELECT * FROM messages WHERE thread_id=987

Slide 58

Slide 58 text

SELECT * FROM threads WHERE account_id=123 SELECT * FROM messages WHERE thread_id=987

Slide 59

Slide 59 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows Jankbusting | Worker Windows SQL | Observables | Tasks

Slide 60

Slide 60 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows Jankbusting | Worker Windows SQL | Observables | Tasks

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

https://github.com/nylas/n1 Open Source

Slide 63

Slide 63 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows Jankbusting | Worker Windows SQL | Observables | Tasks Native extensions | Cross-platform CSS | Retina Detail

Slide 64

Slide 64 text

The Age of the JS Desktop 1. “Native” experience 2. Process Control 3. Performance 4. Data Storage & Offline 5. Plugins & Extensibility Native extensions | Cross-platform CSS | Retina Detail Electron-Rebuild | Node GYP | Windows Jankbusting | Worker Windows SQL | Observables | Tasks Native extensions | Cross-platform CSS | Retina Detail

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

N1 Core Team https://nylas.com/team @e0m @bengotow @juanstejada Halla Moore @jackiehluo Drew Regitsky

Slide 70

Slide 70 text

Evan Morikawa | @e0m | [email protected] | June 2016 Thank you! Slides here