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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
180
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
220
dRuby over BLE
makicamel
2
390
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
210
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.8k
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
120
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
350k
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
170
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
130
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
210
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7k
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
41
2.6k
Between Models and Reality
mayunak
4
350
Rails Girls Zürich Keynote
gr2m
96
14k
Documentation Writing (for coders)
carmenintech
77
5.4k
The Language of Interfaces
destraynor
162
27k
Are puppies a ranking factor?
jonoalderson
1
3.6k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
170
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Paper Plane
katiecoart
PRO
1
52k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
220
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
55k
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