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
【懒懒之道】之轻分享《淘宝观光团hujs总结》——承玉
Search
d2forum
September 29, 2012
1
580
【懒懒之道】之轻分享《淘宝观光团hujs总结》——承玉
d2forum
September 29, 2012
Tweet
Share
More Decks by d2forum
See All by d2forum
TMS的PHP特性
d2forum
0
1.6k
Leap Motion体感实战
d2forum
0
1.2k
跨终端产品实践
d2forum
12
1.9k
Touching Future—s01-e01
d2forum
2
900
KissyCake
d2forum
3
760
贡献标准.s01.e02
d2forum
3
1.3k
一淘响应式设计实践
d2forum
10
960
响应式web设计与实现介绍
d2forum
8
800
定制版设计开发vs响应式设计开发
d2forum
0
170
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Practical Orchestrator
shlominoach
189
11k
Building Adaptive Systems
keathley
43
2.7k
The Cost Of JavaScript in 2023
addyosmani
51
8.5k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Rails Girls Zürich Keynote
gr2m
95
14k
Bash Introduction
62gerente
613
210k
Six Lessons from altMBA
skipperchong
28
3.9k
Transcript
hujs 总结 淘宝观光团 12年9月21⽇日星期五
hujs 12年9月21⽇日星期五
主题 • javascript • nodejs • cloud service • win8
12年9月21⽇日星期五
• javascript 12年9月21⽇日星期五
• knockout.js 12年9月21⽇日星期五
knockout.js 12年9月21⽇日星期五
knockout.js 12年9月21⽇日星期五
12年9月21⽇日星期五
knockout.js 12年9月21⽇日星期五
knockout.js • MVVM • view model • data and behavior
• view • DOM binding • DOM as template • just change view model to sync with view 12年9月21⽇日星期五
knockout.js • my option • DOM oriented • hard to
work with javascript newed component (KISSY) • behavior and view are not separated 12年9月21⽇日星期五
• ECMAScript 5 12年9月21⽇日星期五
Object • Object.create • Object.defineProperty • Object.getPrototype • Object.keys •
Object.getOwnPropertyDescriptor • Object.getOwnPropertyName • Object.seal/preventExtension/freeze ... 12年9月21⽇日星期五
Array • every • some • map • filter •
forEach • reduce • indexOf ... 12年9月21⽇日星期五
JSON • stringify(value,[ [replacer],space]) • parser(text,[reviver]) • subset of javascript
• double quote • not support \x 12年9月21⽇日星期五
‘use strict’; • 禁⽌止不声明的变量 • 禁⽌止 with • 全局 eval
• arguments 不同步参数 • 禁⽌止 caller callee • 禁⽌止对象重复属性名 12年9月21⽇日星期五
• wind.js 调试 12年9月21⽇日星期五
wind.js $wait(readFile); alert('read complete'); readFile(function(){ alert(‘read complete’);
}); compile 12年9月21⽇日星期五
souce map • Generated by closure compiler. Intro • native
support in chrome • 调试压缩/翻译代码 • used at KISSY XTemplate • //@ sourceMappingURL=/path/to/file.js.map or X-‐SourceMap: /path/to/file.js.map 12年9月21⽇日星期五
KISSY XTemplate var tpl = 'this is {{title}}!'; var data
= { title: 'o' }; var render = new XTemplate(tpl, { name: 'tpl-‐variable' }).render(data); 12年9月21⽇日星期五
• Modularization( Seajs, KISSY Loader ) 12年9月21⽇日星期五
• Modularization • 可维护性 • 性能 • 组件(模块)共享 • 调试
12年9月21⽇日星期五
• Promise/A (Q, KISSY) 12年9月21⽇日星期五
Promise • cleaner method signature • nested call changed to
chained call io.get("url1",function(){ io.get('url2',function(){ io.get('url3',function(){ }); }); }) io.get("url1").then(function(){ return io.get("url2") }).then(function(){ return io.get("url3"); }).then(function(data3){ }); 12年9月21⽇日星期五
Promise • easy combination • easy parallel • S.Promise.all(
io.get('url1'), io.get('url2'), function( data1, data2 ){ }); 12年9月21⽇日星期五
Promise • exception-bullet • io.get('url').then(function(){ throw "2";
}).fail(function(w){ alert(w); }); 12年9月21⽇日星期五
Promise • error bubble • io.get("url1").then(function(){ return io.get("url2") }).then(function(){
return io.get("url3"); }).then(function(data3){ },function(err){ alert(error); }); 12年9月21⽇日星期五
Promise • error recovery • io.get("url1").then(function () {
return io.get("url2"); }, function (e) { // error recovery S.log(e); return io.get("url2"); }).then(function (data2) { }); 12年9月21⽇日星期五
• nodejs 12年9月21⽇日星期五
• nodejs proxy for mysql 12年9月21⽇日星期五
优势 • 对⽐比 c/c++ • 简化实现⾮非阻塞异步功能 • 性能差别不⼤大 • 编程复杂度低
12年9月21⽇日星期五
常⽤用模块 • async • ⽅方便异步操作 • log4js • ⽇日志 •
node-webkit-agent • 使⽤用 chrome dev tools 监控服务器端 12年9月21⽇日星期五
• nodejs for webim(⻓长连接) 12年9月21⽇日星期五
优势 • 快速原型 • 学习成本低 • 出众的性能 • 团队⼊入⻔门快 12年9月21⽇日星期五
多进程架构 12年9月21⽇日星期五
nodejs 优化 • ⼦子进程往⽗父进程发送⼼心跳保证稳定 • c++ 扩展提⾼高性能 • cpu 绑定进程
12年9月21⽇日星期五
• nodejs for backend game engine 12年9月21⽇日星期五
game vs web • area based vs load balance •
state vs stateless • broadcast (area) vs request / response • tick vs request 12年9月21⽇日星期五
12年9月21⽇日星期五
12年9月21⽇日星期五
• nodejs @ taobao 12年9月21⽇日星期五
12年9月21⽇日星期五
调优 • console.time / timeEnd • benchmark.js 性能测量 • top
/ iotop @linux • node-webkit-agent • v8profile • nodejs gc log -> jvm gc log 12年9月21⽇日星期五
• cloud service 12年9月21⽇日星期五
cloud • appfog • azure • npm install azure •
git commit • git push azure master 12年9月21⽇日星期五
• win8 12年9月21⽇日星期五
12年9月21⽇日星期五
12年9月21⽇日星期五
thanks 12年9月21⽇日星期五