Slide 1

Slide 1 text

Node on the Desktop Evan Morikawa | @e0m | [email protected] | June 2016

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Node on the Desktop 1. 2. 3. 4. 5.

Slide 7

Slide 7 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. 3. 4. 5.

Slide 8

Slide 8 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. 4. 5.

Slide 9

Slide 9 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. 5.

Slide 10

Slide 10 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5.

Slide 11

Slide 11 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility

Slide 12

Slide 12 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Swing Qt Cocoa GTK WPF/WinRT …

Slide 15

Slide 15 text

NW.js (Node Webkit)

Slide 16

Slide 16 text

Shell

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Chromium

Slide 22

Slide 22 text

Chromium Browser aka Backend aka Main Process

Slide 23

Slide 23 text

Chromium Browser aka Backend aka Main Process C++

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

Nylas N1

Slide 28

Slide 28 text

Nylas N1 main.js

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

Slide 31

Slide 31 text

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

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

Slide 34

Slide 34 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 35

Slide 35 text

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

Slide 36

Slide 36 text

A Marriage of Event Loops

Slide 37

Slide 37 text

Node Event Loop libuv A Marriage of Event Loops

Slide 38

Slide 38 text

Chromium Events MessageLoop Chromium A Marriage of Event Loops

Slide 39

Slide 39 text

Chromium Events MessageLoop Chromium A Marriage of Event Loops Node Event Loop libuv ?

Slide 40

Slide 40 text

Chromium Events libuv Chromium A Marriage of Event Loops

Slide 41

Slide 41 text

Chromium Events MessageLoop Chromium A Marriage of Event Loops Node Event Loop libuv

Slide 42

Slide 42 text

Node Event Loop libuv Chromium Events MessageLoop Chromium A Marriage of Event Loops IO poll

Slide 43

Slide 43 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts

Slide 44

Slide 44 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts

Slide 45

Slide 45 text

Native Electron Extensions npm install sqlite3 electron/electron-rebuild

Slide 46

Slide 46 text

Native Electron Extensions electron/electron-rebuild

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

Native Electron Extensions 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

Slide 49

Slide 49 text

Native Electron Extensions nodejs/node-gyp

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts Node gyp | Compiled for Windows

Slide 52

Slide 52 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts Node gyp | Compiled for Windows

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

ReactiveX.js

Slide 55

Slide 55 text

ReactiveX.js Thank you @mattpodwysocki!

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts Node gyp | Compiled for Windows SQLite | Live Queries to React

Slide 60

Slide 60 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts Node gyp | Compiled for Windows SQLite | Live Queries to React

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts Node gyp | Compiled for Windows SQLite | Live Queries to React Worker Windows

Slide 63

Slide 63 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts Node gyp | Compiled for Windows SQLite | Live Queries to React Worker Windows

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility Shared event loop | Node & Chromium Contexts Node gyp | Compiled for Windows SQLite | Live Queries to React Worker Windows “Installed” Plugins | React

Slide 66

Slide 66 text

Node on the Desktop 1. A Marriage of Node & Chromium 2. Native (Electron) Extensions 3. DOM with fs 4. Process Control 5. Plugins & Extensibility “Installed” Plugins | React Worker Windows SQLite | Live Queries to React Node gyp | Compiled for Windows Shared event loop | Node & Chromium Contexts

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

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

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

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

Slide 71

Slide 71 text

Node on the Desktop Evan Morikawa | @e0m | [email protected] | June 2016