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
Y.App: Coordinating URL Navigation, Routing, an...
Search
Eric Ferraiuolo
May 31, 2012
Programming
2.1k
10
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Y.App: Coordinating URL Navigation, Routing, and Managing Views
Eric Ferraiuolo
May 31, 2012
More Decks by Eric Ferraiuolo
See All by Eric Ferraiuolo
React.js & i18n
ericf
2
490
Node on the Road
ericf
1
130
Pure
ericf
7
990
YUI and The Future
ericf
2
770
YUI 3.10.0 — Go Fast
ericf
3
610
YUI, Open Source, and Community
ericf
0
480
Advocatus Diaboli – Throne of JS
ericf
8
16k
Other Decks in Programming
See All in Programming
RTSPクライアントを自作してみた話
simotin13
0
630
1B+ /day規模のログを管理する技術
broadleaf
0
110
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
300
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.3k
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
790
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
130
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
13k
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
360
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
390
スマートグラスで並列バイブコーディング
hyshu
0
260
Featured
See All Featured
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
340
Evolving SEO for Evolving Search Engines
ryanjones
0
220
A Soul's Torment
seathinner
6
3k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
610
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
BBQ
matthewcrist
89
10k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
490
Designing Powerful Visuals for Engaging Learning
tmiket
1
430
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Transcript
Eric Ferraiuolo, YUI @ericf Y.App URLs, Navigation, Routing, & Views
URLs Core to an App, Part of the UI
http://example.com/foo/ http://example.com/#/foo/ http://example.com/#!/foo/
http://example.com/foo/ http://example.com/#/foo/ http://example.com/#!/foo/
Who’s Data?
Everyone’s?
Everyone’s? Use Full-path URLs
Server’s Ability?
Dumb Server?
Dumb Server? Use Hash-based URLs
Initial State The First Thing a User Sees
Rendering /foo/
http://example.com/foo/
http://example.com/foo/ Fast Puppy! /foo/ HTML
http://example.com/foo/ Fast Puppy! /puppy.jpg IMG /foo/ HTML
Rendering /#/foo/
http://example.com/#/foo/
http://example.com/#/foo/ / HTML
http://example.com/#/foo/ / /app.js JavaScript HTML
http://example.com/#/foo/ / /app.js HTML /foo/ JSON JavaScript Slow Puppy :(
http://example.com/#/foo/ / /app.js HTML /foo/ JSON JavaScript Slow Puppy :(
/puppy.jpg IMG
Render Initial State on the Server, It’s Faster!
5x Faster Twitter is Moving Away From /#!/
Enhance …Progressively
pjax pushState + Ajax
None
Removes Unnecessary Full Page Loads
Automatically Handles <a> Clicks
Does Not Break Browser's Conventions
Client-side Routing Ful lling Requests on the Client
Data in Memory -> No HTTP Request
Seamlessly Support /foo/ & /#/foo/
Responding to URL Changes
<a> Clicks Page Reloads Back/Forward Programatic URL
<a> Clicks Page Reloads Back/Forward Programatic URL Route Handlers
<a> Clicks Page Reloads Back/Forward Programatic URL Route Handlers UI
Y.App
Y.App Y.PjaxBase Y.Router Y.View
Y.App Navigation Routing App View
Y.App Navigation Routing App View View Management Transitions Server Coordination
Hello World Y.App
Hello World Y.App <!DOCTYPE html> <html> <head> <title>Hello World!</title> </head>
<body> <script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script> <script src="app.js"></script> </body> </html>
Hello World Y.App Y.HelloView = Y.Base.create('helloView', Y.View, [], { render:
function () { var name = this.get('name'); this.get('container').set('text', 'Hello ' + (name || 'World') + '!'); return this; } }); var app = new Y.App({ views: { hello: {type: 'HelloView'} } }); app.route('/', function (req) { this.showView('hello'); }); app.route('/:name', function (req) { this.showView('hello', {name: req.params.name}); }); app.render().navigate('/eric');
Hello World Y.App Y.HelloView = Y.Base.create('helloView', Y.View, [], { render:
function () { var name = this.get('name'); this.get('container').set('text', 'Hello ' + (name || 'World') + '!'); return this; } }); var app = new Y.App({ views: { hello: {type: 'HelloView'} } }); app.route('/', function (req) { this.showView('hello'); }); app.route('/:name', function (req) { this.showView('hello', {name: req.params.name}); }); app.render().navigate('/eric');
Hello World Y.App Y.HelloView = Y.Base.create('helloView', Y.View, [], { render:
function () { var name = this.get('name'); this.get('container').set('text', 'Hello ' + (name || 'World') + '!'); return this; } }); var app = new Y.App({ views: { hello: {type: 'HelloView'} } }); app.route('/', function (req) { this.showView('hello'); }); app.route('/:name', function (req) { this.showView('hello', {name: req.params.name}); }); app.render().navigate('/eric');
Hello World Y.App Y.HelloView = Y.Base.create('helloView', Y.View, [], { render:
function () { var name = this.get('name'); this.get('container').set('text', 'Hello ' + (name || 'World') + '!'); return this; } }); var app = new Y.App({ views: { hello: {type: 'HelloView'} } }); app.route('/', function (req) { this.showView('hello'); }); app.route('/:name', function (req) { this.showView('hello', {name: req.params.name}); }); app.render().navigate('/eric');
Hello World Y.App Y.HelloView = Y.Base.create('helloView', Y.View, [], { render:
function () { var name = this.get('name'); this.get('container').set('text', 'Hello ' + (name || 'World') + '!'); return this; } }); var app = new Y.App({ views: { hello: {type: 'HelloView'} } }); app.route('/', function (req) { this.showView('hello'); }); app.route('/:name', function (req) { this.showView('hello', {name: req.params.name}); }); app.render().navigate('/eric');
Hello World Y.App <!DOCTYPE html> <html> <head> <title>Hello World!</title> </head>
<body class="yui3-app"> <script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script> <script src="app.js"></script> <div class="yui3-app-views"> <div>Hello eric!</div> </div> </body> </html>
Square ing
Square ing
Photos Near Me
Photos Near Me
Questions? Eric Ferraiuolo, YUI @ericf