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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ping-Yen Tsai
June 20, 2012
Technology
300
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
190
我的工作經驗 (到目前為止)
pingyen
2
490
網頁前端⼯程師與室內裝修師傅的相似之處
pingyen
0
170
JavaScript Closure
pingyen
1
150
HTML5 Sectioning Elements
pingyen
0
100
次世代搜尋引擎戰爭
pingyen
0
160
進階 JavaScript
pingyen
0
300
jQuery 入門
pingyen
0
140
Windows 市集應⽤用程式實例解說 (使⽤ JavaScript)
pingyen
0
170
Other Decks in Technology
See All in Technology
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
私がブラウザを自作したくなった理由
supurazako
1
240
修正PRを食べてレビュースキルが賢くなる:Claude Codeによる自己改善サイクル
yuyaumetsu
6
1.5k
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
740
SO-101×VLAによる3色キューブのピック&プレース
abeja
0
200
20260807_第6回_関東kaggler会LT_claw系bot xangiと始める、"寂しくない" kaggle
sugupoko
0
280
【CEDEC2026】ゲームシナリオライターを支援するAIツール開発の実践 ― 設計とプロンプトの工夫 ―
cygames
PRO
1
860
Head First モブプログラミング / Head First Mobprogramming
takaking22
10
12k
Kiro Crew入門 - 常駐エージェントの仕組みと使いどころ / Intro to Kiro Crew
k_adachi_01
1
120
猫付きpingコマンドを自作
uyuki234
0
240
LanceDB入門
mocobeta
7
510
FPGAが実現する遠方宇宙の高空間分解能天体撮影 -大型地上望遠鏡の視力を補正する「補償光学」とは?-
komei_mt
0
250
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Tell your own story through comics
letsgokoyo
1
1k
Speed Design
sergeychernyshev
33
2k
Amusing Abliteration
ianozsvald
1
250
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
330
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
370
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
520
Documentation Writing (for coders)
carmenintech
77
5.4k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
530
30 Presentation Tips
portentint
PRO
1
370
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
650
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
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
謝謝