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
さぁV100、メモリをお食べ・・・
nilpe
0
140
Webフレームワークの ベンチマークについて
yusukebe
0
170
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
140
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
680
Vite+ Unified Toolchain for the Web
naokihaba
0
310
net-httpのHTTP/2対応について
naruse
0
480
CSC307 Lecture 17
javiergs
PRO
0
320
Oxcを導入して開発体験が向上した話
yug1224
4
310
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
6
1.1k
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
240
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
250
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
Un-Boring Meetings
codingconduct
0
310
How GitHub (no longer) Works
holman
316
150k
Visualization
eitanlees
152
17k
Navigating Weather and Climate Data
rabernat
0
220
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
Evolving SEO for Evolving Search Engines
ryanjones
0
220
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
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