Recommended
Progressive Mobile Web Apps
Modernizerを用いたHTML5Webサイトの構築
Introduction to Service Worker
Java Script - Object-Oriented Programming
이승재, 강성훈, 내가 만든 언어의 개발환경을 Visual Studio Code로 빠르고 쉽게 구축하기 #2, NDC2017
jQuery - Javascript para quem não sabe Javascript
Node.js をさりげなく取り入れた 最近のフロントエンド事情について
Poetry in the age of hip-hop
Javascript and jQuery for Mobile
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシー
Focus on the outside, testing in ASP.NET MVC
F# Eye for the C# Guy - DDD North 2013
More Related Content
Progressive Mobile Web Apps
What's hot
Modernizerを用いたHTML5Webサイトの構築
Introduction to Service Worker
Java Script - Object-Oriented Programming
이승재, 강성훈, 내가 만든 언어의 개발환경을 Visual Studio Code로 빠르고 쉽게 구축하기 #2, NDC2017
jQuery - Javascript para quem não sabe Javascript
Node.js をさりげなく取り入れた 最近のフロントエンド事情について
Poetry in the age of hip-hop
Javascript and jQuery for Mobile
jQueryでつくる、動きのあるWebページ - 多摩美 メディアリテラシー
Viewers also liked Focus on the outside, testing in ASP.NET MVC
F# Eye for the C# Guy - DDD North 2013
Controller Testing: You're Doing It Wrong
Unit Testing in JavaScript with MVC and QUnit
DDD, CQRS and testing with ASP.Net MVC
Laws of test automation framework
CQRS на практике. В поиске точки масштабирования и новых метафор
Unit and integration Testing
Model View Controller (MVC)
Behavior Driven Development with Cucumber
Web App Mvc 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 前后端 MVC 交互 传统 /*PHP*/ $result = mysql_query ( 'SELECT name FROM users' ); while ( $row = mysql_fetch_array ( $result )) { echo " <b> " . $row [ 'name' ]. " </b> " ; echo " <br/> " ; } //jQuery $ . get ( location . origin + '/names.php' ) . done (function ( data ) { $ ( 'body' ). append ( data ); }); 11. 12. 高性能 //Node.js with Web.js and MongoSkin var getRouter = { 'names' : function ( req , res , qs ) { db . collection ( 'names' ) . find ({}) . toArray (function ( err , names ) { res . sendJSON ( names ); }) } }; web . get ( getRouter ); 前后端 MVC 交互 13. 前后端 MVC 交互 高性能 //jQuery, Mustache.js $ . get ( location . origin + ' /names ' ) . done (function ( data ) { var $names = JSON . parse (data); $ . get ( location . origin + ' /tmlp/names.html ' ) . done (function ( data ) { $html = Mustache . to_html (data, {names: $names }); $( ' body ' ) . append ( $html ); }); }); 14. 15. 终端性能 CPU 运算 V8 来自 Google 的基于 C++ 的高性能 JavaScript 引擎 Worker API 多线程 JavaScript 运行机制 GPU 硬件加速 Canvas 绘图加速 Video API 解码加速 DOM 渲染加速 移动终端的超强交互性能 16. 终端性能 存储机制 Cookies localStorage sessionStorage Web SQL Cache 交互机制 WebSocket Message Model Ajax Level 2 …… 不仅不能避免缓存, 而且要主动存储! 不要让 Web 成为 Long Polling 的天下! 17. 18. 19. 20. 21. 22. JavaScript — 因为不严谨而飞速发展的脚本语言 Node.js — 基于不严谨的强悍服务器 Web.js — 基于简易的高性能 Node.js 开发框架 23. 24. 25. //ExpressJS var app = require ( 'express' ). createServer (); app . get ( '/*' , function ( req , res ) { res . sendfile ( req . get ( 'content-disposition' , 'filename' )); }); app . listen ( 80 ); //Web.js require ( 'webjs' ). run () //Node.js var http = require ( 'http' ), fs = require ( 'fs' );……… server . on ( 'request' , function ( req , res ) { ……… }). listen ( 80 ); 26. 27. 28. 29. var Person = Backbone.Model.extend({ sayHello : function () { console.log(this.get('name')); } }); var me = new Person({name: 'Will'}); me.sayHello(); // -> 'Will' 30. var People = Backbone.Collection.extend({ sayHello : function () { this.map(function (person) { return this.get('name') + 'say: "Hello, I`m ' + this.get('name') + '."\n'; }); } }); var w3ctech = new People; w3ctech.add({name: 'Will'}, {name: 'Foo'}, {name: 'Bar'}); w3ctech.sayHello(); /** -> Will say: "Hello, I`m Will." * Foo say: "Hello, I`m Foo." * Bar say: "Hello, I`m Bar." **/ 31. 32. 33. Mustache.js < table > < tbody > {{# peoples }} {{# Man }} < tr > < td >{{ Name }}</ td > < td >{{ Age }}</ td > < td >{{ Sex }}</ td > </ tr > {{/ Man }} {{/ peoples }} </ tbody > </ table > 模版 34. Mustache.js var obj = { peoples : [ { Name : 'Will' , Age : 15 , Sex : 'Man' }, { Name : 'Foo' , Age : 30 , Sex : 'Woman' }, { Name : 'Bar' , Age : 18 , Sex : 'Man' }], Man : function () { if ( this . Sex == 'Man' ) { return function ( text , render ) { render ( text ); } } } }; 对象 35. Web.js with Mustache.js var getRouter = { '^mans' : function ( req , res , qs ) { mansHtml = web . render ( 'mans' , obj ); res . send ( mansHtml ); } }; web . set ( 'tmplDir' , 'tmlps' ) . get ( getRouter ); 36. 37. Web.js var postRouter = { 'seturlrouter' : function ( req , res , qs ){ web . get ({ qs . key : qs . value }); res . send ( 'Set success' ); } }; web . post ( postRouter ); 38. 39. //For IE function parseQs () { var qs = ( location . search > 0 ? location . search . substring ( 1 ) : '' ), params = {}, items = qs . split ( "&" ), _item = null ; for (var i = 0 ; i < items . length ; i ++) { item = items [ i ]; params [ decodeURIComponent ( item [ 0 ])] = decodeURIComponent ( item [ 1 ]); } return params ; } location . qs = parseOs (); JavaScript MVC 40. JavaScript MVC //For Chrome, FireFox and more location . __defineGetter__ ( 'qs' , function() { var qs = ( location . search > 0 ? location . search . substring ( 1 ) : '' ), params = {}, items = qs . split ( "&" ), _item = null ; for (var i = 0 ; i < items . length ; i ++) { item = items [ i ]; params [ decodeURIComponent ( item [ 0 ])] = decodeURIComponent ( item [ 1 ]); } return params ; }); 41. JavaScript MVC (function ( $ ) { $ . getScript ( location . origin + '/js/web-client.js' ); //Web.js for Client var getRouter = { 'getsomething' : function () { $ ( 'body' ). append ( web . getData ( 'something' ) . render ( 'someTmpl' ) ); } }; web . conn ( location . origin ) . get ( getRouter ) })( jQuery ); 42. 43. 44.