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
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
180
A2UI という光を覗いてみる
satohjohn
1
150
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
170
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
940
Lessons from Spec-Driven Development
simas
PRO
0
220
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
210
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
320
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
210
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
140
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
230
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
150
Featured
See All Featured
A Soul's Torment
seathinner
6
3k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
The agentic SEO stack - context over prompts
schlessera
0
820
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
220
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
200
Bash Introduction
62gerente
615
220k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Embracing the Ebb and Flow
colly
88
5.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Optimizing for Happiness
mojombo
378
71k
Git: the NoSQL Database
bkeepers
PRO
432
67k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
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