Transcript
Page 1: Node.js 進攻桌面開發

Node.js進攻桌面開發

用 HTML5 開發跨平台的單機版應用程式!

Page 2: Node.js 進攻桌面開發

錢逢祥

Fred Chien

Page 3: Node.js 進攻桌面開發

錢逢祥

Fred Chien

Page 4: Node.js 進攻桌面開發

fred-zone.blogspot.com

Page 5: Node.js 進攻桌面開發

cfsghost At gmail.com

Page 6: Node.js 進攻桌面開發

Mandice

Page 7: Node.js 進攻桌面開發
Page 8: Node.js 進攻桌面開發

How many people know

有多少人知道

Page 9: Node.js 進攻桌面開發

JavaScript 開發年資大調查

JavaScript 辛酸血淚史

Page 10: Node.js 進攻桌面開發

奇怪的運作原理

沿街叫罵喊打

Page 11: Node.js 進攻桌面開發

語法設計差

醜不拉嘰

Page 12: Node.js 進攻桌面開發

效能不彰

動作緩慢

Page 13: Node.js 進攻桌面開發

會 Copy & Paste 就可以自稱會寫

開發者都不開發者了

還記得首頁製作百寶箱這個可怕的箱子嗎?

Page 14: Node.js 進攻桌面開發

Nobody knows

殊不知

Page 15: Node.js 進攻桌面開發

Lovely

鐘樓怪人也有可人的一面

Page 16: Node.js 進攻桌面開發

史瑞克 仍可把到正妹

Page 17: Node.js 進攻桌面開發

V8 + APIs

Node.js

Page 18: Node.js 進攻桌面開發

百年修得同船渡

Page 19: Node.js 進攻桌面開發

Enough !?

你這樣就滿足了嗎?

Page 20: Node.js 進攻桌面開發

泡麵科技產業

當泡麵師父都可以來賣電腦

Page 21: Node.js 進攻桌面開發

我們怎麼可以止步不前?

Page 22: Node.js 進攻桌面開發

最少也應該吃泡麵洩恨

Page 23: Node.js 進攻桌面開發

然後努力搞點新花樣

Page 24: Node.js 進攻桌面開發
Page 25: Node.js 進攻桌面開發

JavaScript 已經征服三大洲

Page 26: Node.js 進攻桌面開發

前端、後端、雲端

Page 27: Node.js 進攻桌面開發

What's Next?

Page 28: Node.js 進攻桌面開發

桌面應用程式

JavaScript

Page 29: Node.js 進攻桌面開發

Think About It

Page 30: Node.js 進攻桌面開發

瀏覽器

性感的存在

Page 31: Node.js 進攻桌面開發
Page 32: Node.js 進攻桌面開發

HTML5CSS

WebGL

Page 33: Node.js 進攻桌面開發

HTML5CSS

WebGL

Page 34: Node.js 進攻桌面開發

HTML5CSS

WebGL

Page 35: Node.js 進攻桌面開發

My Application

HTML5CSS

WebGL

Page 36: Node.js 進攻桌面開發

window.open('page.html', *=no);

喔。不過就是沒邊框。

Page 37: Node.js 進攻桌面開發

誰都會

把瀏覽器扒光而已嘛

Page 38: Node.js 進攻桌面開發
Page 39: Node.js 進攻桌面開發

看到全裸的美女無動於衷?

Page 40: Node.js 進攻桌面開發

My Application

HTML5CSS

WebGL

Page 41: Node.js 進攻桌面開發

My Application

Node.js Inside

Page 42: Node.js 進攻桌面開發

node-webkit at github

node-webkit

Page 43: Node.js 進攻桌面開發

這意味著我不想要.....

Page 44: Node.js 進攻桌面開發

HTTP ServerNode.js

Page 45: Node.js 進攻桌面開發

HTTP ServerNode.js

GET/POST/...

RESTful APIsAjax....etc

Page 46: Node.js 進攻桌面開發

HTTP ServerNode.js

GET/POST/...

RESTful APIsAjax....etc

Page 47: Node.js 進攻桌面開發
Page 48: Node.js 進攻桌面開發

<html><head><title>Hey</title><script> var fs = require('fs'); fs.unlinkSync('/home/fred/聊天記錄');</script></head></html>

我希望這樣寫一支程式 killsecret.html

Page 49: Node.js 進攻桌面開發

node-webkit +

killsecret.html

Page 50: Node.js 進攻桌面開發

立即殺光我的小秘密

沒有用到 HTTP 方法

Page 51: Node.js 進攻桌面開發
Page 52: Node.js 進攻桌面開發

瀏覽器本身內建 Node.js

node-webkit

Page 53: Node.js 進攻桌面開發

絕對比 IE 支援更多 Web 標準

追隨著 Chromium 的腳步

Page 54: Node.js 進攻桌面開發

HTML5/CSS3/WebGL... etc

追隨著 Chromium 的腳步

Page 55: Node.js 進攻桌面開發

還可以跨平台 Windows/Linux/Mac

追隨著 Chromium 的腳步

Page 56: Node.js 進攻桌面開發

數以萬計的第三方模組

用 Node.js 熬七七四十九天

Page 57: Node.js 進攻桌面開發

經過後端考驗的穩定度

用 Node.js 熬七七四十九天

Page 58: Node.js 進攻桌面開發

將 JS 程式 Compile 成 Binary 檔

其他更多功能

Page 59: Node.js 進攻桌面開發

將 JS 程式打包進執行檔內

其他更多功能

Page 60: Node.js 進攻桌面開發
Page 61: Node.js 進攻桌面開發

Usage

如何打造桌面應用程式

Page 62: Node.js 進攻桌面開發

index.htmljs/img/css/

Your Application

Page 63: Node.js 進攻桌面開發

index.htmljs/img/css/

Your Applicationpackage.json

Page 64: Node.js 進攻桌面開發

{"name": "hello world","main": "index.html"

}

package.json

Page 65: Node.js 進攻桌面開發

Run

執行

Page 66: Node.js 進攻桌面開發

./nw /home/fred/myapp

nw [App Path]

Page 67: Node.js 進攻桌面開發

myapp.nw

你也可以打包成 ZIP 檔

Page 68: Node.js 進攻桌面開發

執行包成 ZIP 檔的程式

Page 69: Node.js 進攻桌面開發

./nw /home/fred/myapp.nw

nw [zip file]

Page 70: Node.js 進攻桌面開發

myapp.exe (standalone)

做成獨立執行檔

Page 71: Node.js 進攻桌面開發

Windows

copy /b nw.exe+app.nw myapp.exe

Page 72: Node.js 進攻桌面開發

Linux

$ cat /usr/bin/nw app.nw > myapp $ chmod +x myapp

Page 73: Node.js 進攻桌面開發

node-webkit

Page 74: Node.js 進攻桌面開發

node-webkit

myapp.nw

Page 75: Node.js 進攻桌面開發

node-webkit

myapp.nw

Page 76: Node.js 進攻桌面開發

Live Demo

Page 77: Node.js 進攻桌面開發

更多實例

Page 78: Node.js 進攻桌面開發

Markdown Editor

Page 79: Node.js 進攻桌面開發

Tool for Web Developer

Page 80: Node.js 進攻桌面開發

Reddit Client

Page 81: Node.js 進攻桌面開發
Page 82: Node.js 進攻桌面開發

附帶一提

Page 83: Node.js 進攻桌面開發

Node.js可以開發桌面應用

Page 84: Node.js 進攻桌面開發

舊電腦

Raspberry PiARM Board

...

Page 85: Node.js 進攻桌面開發

甚至使用 node-webit 跑 GUI 程式?

跑 Node.js 應用?

Page 86: Node.js 進攻桌面開發

純 JavaScript開發嵌入式系統?

Page 87: Node.js 進攻桌面開發

買了很多 ARM 板丟一邊的舉手?

不是每個人都搞 Porting

Page 88: Node.js 進攻桌面開發

Stem

Page 89: Node.js 進攻桌面開發

讓你無痛跑 Node.js 應用的嵌入式 OS

Stem

Page 90: Node.js 進攻桌面開發

Support x86 and ARM

Stem

Page 91: Node.js 進攻桌面開發

千萬別用中文單唸這個名字,感謝。

Stem

Page 92: Node.js 進攻桌面開發

當然也別用 Google Translate

Stem

Page 93: Node.js 進攻桌面開發

stem.mandice.org

Download

Page 94: Node.js 進攻桌面開發

懂 Node.js + Web 就可以 DIY 嵌入式應用

硬體這麼便宜

Page 95: Node.js 進攻桌面開發

懂 Node.js + Web 就可以 DIY 嵌入式應用

HW + Stem OS + Your App

Page 96: Node.js 進攻桌面開發

Enjoy It

Page 97: Node.js 進攻桌面開發

Question ?

Page 98: Node.js 進攻桌面開發

Thanks !