SlideShare a Scribd company logo
1 of 10
Ember.AutoLocation
location: ‘auto’ for Ember.Router
Jay Phelps
Dudebro @ Pivotshare
Location = Stateless
• Direct page access without an in-app referrer
• Page refreshes
• Bookmarks
• Sharing (outbound referrer)
• Back/forward buttons
• Decoupling pages
• Code reuse and drastically improved organization
Native applications don’t have this problem. You
can’t jump into any random section of the app.
Native applications don’t have this problem. You
can’t jump into any random section of the app.
Ember.Router
•Manages application state via pre-defined routes
App.Router.map(function () {
this.route('about');
});
•Abstracts browser inconsistencies
•Currently supports history/hash/none
history.pushState() Support
IE9 doesn’t even support it!IE9 doesn’t even support it!
hashchange as a fallback?
• Pretty URLs for modern browsers (SEO, forward looking)
• https://example.com/about
• Hashes for everyone else
• https://example.com/#/about
or pushState as a fall forward
How AutoLocation Works
• Checks what the browser supports
• Supports pushState? hashchange?
• Compares support vs. current URL format
• Transforms current URL into supported (if needed)
• /about => /#/about (vise versa)
• Provides supported Ember.Location class to the Router
• Handlebars `LinkTo` provides currently supported URLs (clean in pushState, hash in older)
Using It
App.Router.reopen({
location: 'auto'
});
Client side
Using It
• Apache mod_rewrite
• RewriteRule ^(.*)$ bootstrap.php [QSA, L]
• Rails
• match '/*path' => 'pages#bootstrap'
These won’t give 404’s!
Server side
I’m not a full time Rails guy so there’s
likely a better way of doing this.
I’m not a full time Rails guy so there’s
likely a better way of doing this.
If your app isn’t served from the root path, you’ll
need to assign Ember.AutoLocation.rootPath to the
path you want it to ignore; the part that never
changes.
e.g. /app/#/about
If your app isn’t served from the root path, you’ll
need to assign Ember.AutoLocation.rootPath to the
path you want it to ignore; the part that never
changes.
e.g. /app/#/about
When Can I Play!
• Hopefully 1.0 final!
• Try it now: https://github.com/emberjs/ember.js/pull/2685
Questions?
Please point out possible issues!
hello@jayphelps.com
github: jayphelps

More Related Content

Viewers also liked

Prawna ochrona dóbr osobistych człowieka, w tym
Prawna ochrona dóbr osobistych człowieka, w tymPrawna ochrona dóbr osobistych człowieka, w tym
Prawna ochrona dóbr osobistych człowieka, w tym
Jolanta Kałuża
 
Total quality-management-tqm
Total quality-management-tqmTotal quality-management-tqm
Total quality-management-tqm
ryzen12
 

Viewers also liked (8)

Mój wymarzony zawód
Mój wymarzony zawódMój wymarzony zawód
Mój wymarzony zawód
 
Prezentacja 16 maja 2013
Prezentacja 16 maja 2013Prezentacja 16 maja 2013
Prezentacja 16 maja 2013
 
ES2015 and Beyond
ES2015 and BeyondES2015 and Beyond
ES2015 and Beyond
 
Tytoń
TytońTytoń
Tytoń
 
Prawna ochrona dóbr osobistych człowieka, w tym
Prawna ochrona dóbr osobistych człowieka, w tymPrawna ochrona dóbr osobistych człowieka, w tym
Prawna ochrona dóbr osobistych człowieka, w tym
 
Total quality-management-tqm
Total quality-management-tqmTotal quality-management-tqm
Total quality-management-tqm
 
Intro to Ember.js
Intro to Ember.jsIntro to Ember.js
Intro to Ember.js
 
Typescript - MentorMate Academy
Typescript - MentorMate AcademyTypescript - MentorMate Academy
Typescript - MentorMate Academy
 

More from Jay Phelps

More from Jay Phelps (9)

Backpressure? Resistance is not futile. RxJS Live 2019
Backpressure? Resistance is not futile. RxJS Live 2019Backpressure? Resistance is not futile. RxJS Live 2019
Backpressure? Resistance is not futile. RxJS Live 2019
 
Backpressure? Resistance is not futile. (Uphill Conf 2019)
Backpressure? Resistance is not futile. (Uphill Conf 2019)Backpressure? Resistance is not futile. (Uphill Conf 2019)
Backpressure? Resistance is not futile. (Uphill Conf 2019)
 
React, Powered by WebAssembly
React, Powered by WebAssemblyReact, Powered by WebAssembly
React, Powered by WebAssembly
 
Why I Love JSX!
Why I Love JSX!Why I Love JSX!
Why I Love JSX!
 
The WebAssembly Revolution Has Begun
The WebAssembly Revolution Has BegunThe WebAssembly Revolution Has Begun
The WebAssembly Revolution Has Begun
 
WebAssembly Demystified
WebAssembly DemystifiedWebAssembly Demystified
WebAssembly Demystified
 
Real-time Insights, powered by Reactive Programming
Real-time Insights, powered by Reactive ProgrammingReal-time Insights, powered by Reactive Programming
Real-time Insights, powered by Reactive Programming
 
RxJS + Redux + React = Amazing
RxJS + Redux + React = AmazingRxJS + Redux + React = Amazing
RxJS + Redux + React = Amazing
 
Intro to Ember CLI
Intro to Ember CLIIntro to Ember CLI
Intro to Ember CLI
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Ember.AutoLocation

  • 1. Ember.AutoLocation location: ‘auto’ for Ember.Router Jay Phelps Dudebro @ Pivotshare
  • 2. Location = Stateless • Direct page access without an in-app referrer • Page refreshes • Bookmarks • Sharing (outbound referrer) • Back/forward buttons • Decoupling pages • Code reuse and drastically improved organization Native applications don’t have this problem. You can’t jump into any random section of the app. Native applications don’t have this problem. You can’t jump into any random section of the app.
  • 3. Ember.Router •Manages application state via pre-defined routes App.Router.map(function () { this.route('about'); }); •Abstracts browser inconsistencies •Currently supports history/hash/none
  • 4. history.pushState() Support IE9 doesn’t even support it!IE9 doesn’t even support it!
  • 5. hashchange as a fallback? • Pretty URLs for modern browsers (SEO, forward looking) • https://example.com/about • Hashes for everyone else • https://example.com/#/about or pushState as a fall forward
  • 6. How AutoLocation Works • Checks what the browser supports • Supports pushState? hashchange? • Compares support vs. current URL format • Transforms current URL into supported (if needed) • /about => /#/about (vise versa) • Provides supported Ember.Location class to the Router • Handlebars `LinkTo` provides currently supported URLs (clean in pushState, hash in older)
  • 8. Using It • Apache mod_rewrite • RewriteRule ^(.*)$ bootstrap.php [QSA, L] • Rails • match '/*path' => 'pages#bootstrap' These won’t give 404’s! Server side I’m not a full time Rails guy so there’s likely a better way of doing this. I’m not a full time Rails guy so there’s likely a better way of doing this. If your app isn’t served from the root path, you’ll need to assign Ember.AutoLocation.rootPath to the path you want it to ignore; the part that never changes. e.g. /app/#/about If your app isn’t served from the root path, you’ll need to assign Ember.AutoLocation.rootPath to the path you want it to ignore; the part that never changes. e.g. /app/#/about
  • 9. When Can I Play! • Hopefully 1.0 final! • Try it now: https://github.com/emberjs/ember.js/pull/2685
  • 10. Questions? Please point out possible issues! hello@jayphelps.com github: jayphelps