Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
從前端工程師觀點看 Metro Style App 開發
Search
Ping-Yen Tsai
June 20, 2012
Technology
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
從前端工程師觀點看 Metro Style App 開發
2012 微軟開發者日
Ping-Yen Tsai
June 20, 2012
More Decks by Ping-Yen Tsai
See All by Ping-Yen Tsai
「台灣報紙新聞」與「台灣即時新聞」
pingyen
0
180
我的工作經驗 (到目前為止)
pingyen
2
480
網頁前端⼯程師與室內裝修師傅的相似之處
pingyen
0
170
JavaScript Closure
pingyen
1
150
HTML5 Sectioning Elements
pingyen
0
94
次世代搜尋引擎戰爭
pingyen
0
160
進階 JavaScript
pingyen
0
300
jQuery 入門
pingyen
0
130
Windows 市集應⽤用程式實例解說 (使⽤ JavaScript)
pingyen
0
160
Other Decks in Technology
See All in Technology
Vポイント分析基盤におけるデータモデリング20年史
taromatsui_cccmkhd
4
730
大 AI 時代におけるC# の事情 ~ぶっちゃけトークを交えながら~
nenonaninu
1
130
SRENEXT_2026_Chairs__Talks_in_Tamachi.sre.pdf
srenext
1
150
Aurora MySQL 8.4リリース! Rubyistが備えること / what-rubyist-should-prepare-for-aurora-mysql-8-4
fkmy
0
820
複数プロダクト組織のAIネイティブ化における戦略 / AICon2026_kude
rakus_dev
0
300
第67回コンピュータビジョン勉強会CVPR2026読会前編
tsukamotokenji
0
170
伝票作成AIエージェントを支える、LLMOpsとインフラの選択肢 / AICon2026_takeda
rakus_dev
0
260
ダッシュボード"開発"について 〜使われるダッシュボードのつくりかた〜
kimichan
0
200
人とエージェントが高め合う協業設計
kintotechdev
0
760
JAWS_ICEBERG_BASECAMP
iqbocchi
2
110
OPENLOGI Company Profile for engineer
hr01
1
74k
41歳でAWSが好きすぎてITエンジニアになったおっさんの話
yama3133
1
740
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
BBQ
matthewcrist
89
10k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.5k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
190
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
190
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Design in an AI World
tapps
1
270
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
For a Future-Friendly Web
brad_frost
183
10k
Transcript
None
從前端⼯工程師觀點看 Metro Style App 開發 蔡秉諺 Vexed 中華電信隨意窩 Xuite
JavaScript
JavaScript
⼀一切的根源 JavaScript 跟其他語⾔言太不⼀一樣了 Prototype based inheritance Weak typing Functions
are objects Closure
出現了兩種⼈人 想把 JavaScript 變成他會的語⾔言 想⽤用 JavaScript 統治世界
想把 JavaScript 變成他會的語⾔言 Google Web Toolkit Java -> JavaScript
CoffeeScript CoffeeScript -> JavaScript Ruby
想⽤用 JavaScript 統治世界 nodeJS WebOS B2G Tizen PhoneGap Titanium
WebView .NET Qt GTK+ Chrome Firefox Extension / App
SQLite Manager :: Firefox Add-on
Secure Shell - Chrome App
Chrome / Firefox App JavaScript API 不⾜足 Chrome -> Native
Client (C++) Firefox -> NPAPI (C++) UX 先開瀏覽器 e.g., SQLite Manager
None
None
謝天謝地 微軟站在 ⽤用 JavaScript 統治世界 這邊
Windows 8 開發架構圖
幾乎是 Windows 7 版本號碼 6.2 Windows on ARM 不可安裝第三⽅方程式與外掛 不可安裝
FLASH ActiveX
(Server +) Client sandbox same origin policy
on IE10 Client / Browser 經驗 Debug 、 第三⽅方 Library
jQuery YUI Knockout Backbone
DOM Explorer
JavaScript Console
Metro style App using JavaScript in IE10 sandbox 沒有 same
origin policy 多 Windows 物件 多 WinJS 物件 少⼀一些函式 …
Windows 物件 不是 window 物件 Windows Runtime API WinRT
API C++ C# VB JavaScript 共通 使⽤用同⼀一般 JavaScript 物件 Windows.Storage.KnownFolders.musicLibrary
JavaScript API 充⾜足
Windows 物件不夠⽤用? ⾃自⼰己寫 WinRT Component C++ C# VB
WinJS 物件 Windows Library for JavaScript 100% JavaScript 寫成 jQuery
100% JavaScript 寫成 YUI 100% JavaScript 寫成 WinJS 100% JavaScript 寫成 看不懂可以看原始碼
WinJS 100% JavaScript 寫成 base.js WinJS ui.js WinJS.UI
WinJS.Promise 超過 0.5 秒 ⾮非同步 吐回 Promise 物件
IO readText() 、 PickSingleFileAsync() AJAX WinJS.xhr() 與 callback 相⽐比 語意清晰
AJAX a.php -> b.php -> c.php var xhr = new
XMLHttpRequest(); xhr.open('GET', 'a.php', true); xhr.onreadystatechange(function() { if(http.readyState == 4 && http.status == 200) { xhr.open('GET', 'b.php', true); xhr.onreadystatechange(function() { if(http.readyState == 4 && http.status == 200) { xhr.open('GET', 'c.php', true); xhr.onreadystatechange(function() { if(http.readyState == 4 && http.status == 200) { // ... } } xhr.send(); } } xhr.send(); } }); xhr.send();
AJAX a.php -> b.php -> c.php WinJS.xhr('a.php') .then(function() { return
WinJS.xhr('b.php'); }) .then(function() { return WinJS.xhr('c.php'); }) .done(function() { // ... });
AJAX a.php b.php c.php 同時送出 等三者皆完成 再下⼀一步 不⽤用 Promise
AJAX a.php b.php c.php 同時送出 WinJS.Promise.join([ WinJS.xhr('a.php'), WinJS.xhr('b.php'), WinJS.xhr('c.php')]) .done(function()
{ // ... });
還多了什麼? Live Connect API DOM MSApp MSProtocol MSProtocolsCollection
少了什麼? alert() confirm() prompt() 請⽤用 Windows.UI.Popups.MessageDialog … window .open() .close()
.moveBy() .moveTo() .resizeBy() .resizeTo() …
IE10 ECMAScript 5 "use strict"; [].map() Object getter
setter WinJS.Binding.as
IE10 CSS3 transition transform animation Grid Layout dev.w3.org 2010
年微軟提出 display : -ms-grid; -ms-grid-columns -ms-grid-column -ms-grid-column-span
Controls HTML5 有的 ⽤用 HTML 寫 HTML5 沒有的 <div
data-win-control="…" data-win-options="{ … }" > </div>
HTML5 有的 Controls <button>A Button</button> <video controls="controls" >
<source src="video.mp4" type="..." > </video> <canvas /> …
HTML5 沒有的 Controls DatePicker Rating ListView FlipView … <div
data-win-control="WinJS.UI.DatePicker" data-win-options="{ current: '2/20/2011' }" > </div> App 開啟時或 DOMContentLoaded 時 執⾏行 WinJS.UI.processAll();
Template data { title: "Banana", text: "Banana Frozen Yogurt", picture:
"images/banana.jpg" }
Template HTML <div data-win-control="WinJS.Binding.Template"> <div> <img data-win-bind="alt: title; src: picture"
/> <h4 data-win-bind="innerText: title" ></h4> <h6 data-win-bind="innerText: text" ></h6> </div> </div>
Application lifecycle 沒有關閉 App Suspened -> NotRunning 不會通知你
Charms & Contracts
Charms & Contracts
Charms & Contracts
考量各種檢視尺⼨寸 最⼩小 1024 * 768 最佳 1366 * 768
Snap View 320 * 768 1024 * 768
UX Metro® is a design language Guideline Guideline Guideline
對使⽤用者⼀一定是好事 對開發者和美術呢? Windows store 上架審核?
single-page navigation Grid App 點下 item 怎麼沒換⾴頁? 只有網⾴頁中間換內容?
把 <a> 預設動作 ⽤用 e.preventDefault() 擋掉! WinJS.UI.Pages & navigation.js
dev.windows.com MSDN Sample
謝謝