Single Page Applications
ronald@nforza.nl
@ronaldhamsen
•
•
•
•

13:00 – 14:15 Introduction SPA
14:15 – 15:30 Break
15:30 – 15:45 Practice!
15:45 – 16:00 Q&A
Wikipedia:
A single-page application (SPA), also known as
single-page interface (SPI), is a web application
or web site that fits on a single web page with
the goal of providing a more fluid user
experience akin to a desktop application.
• More responsive UI / UX
• “Application like” interaction
• Distributed computing (offloading rendering
tasks to the client)
• Ability to go offline
• Less data traffic
• Back/forward button work as expected?
2005 - The term single-page application was
coined by Steve Yen
2003 – Article: Inner-browsing extending the
browser navigation paradigm (MDN)
2002 - Self-Contained website at
http://slashdotslash.com with the same goals
and functions (Stuart Morris)
• DOM manipulation:
Viewmanagement, Templating
• Managing state
• Databinding
• Data-access / Calling services
• Modules and application composition
• Testing
• Showing and hiding elements (views)
• Templating

EJS

}

Hogan.js
• Originally managed by page (url)
• Backbutton in browser?
• Integration with google analytics?
• How to handle in SPA?

• But also: credentials, sessions etc.
• <url>/#somestate -> <url>#somesecondstate
window.onhashchange = function () {
// do something

}
• window.location.hash (beware ie6 and 7)
• jquery.hashchange.js (Ben Alman)
•
•
•
•
•

window.history.back()
window.history.forward()
window.history.pushState(stateObj,title,url)
window.history.replaceState(stateObj, title, url)
window.onpopstate
gives back state on page back/forward

jquery.pathchange.js
• Dependencies in code on frameworks
http://www.sidewaffle.com
+ take a look at hot towel by John Papa
http://yeoman.io
Ideas:

“Build a simple time tracking app.
Date, description, number of hours”
“Create a simple CRM simpel. Contacts, history
of events per contact.”
Tips:
Use bootstrap! http://getbootstrap.com
Choose a framework:
Durandal or Angular, or start with jQuery.
Focus on front-end, never mind the database,
rest-services etc.
Single page webapplications
Single page webapplications

Single page webapplications

Editor's Notes

  • #7 https://developer.mozilla.org/en-US/docs/Inner-browsing_extending_the_browser_navigation_paradigm
  • #12 http://www.adequatelygood.com/Saner-HTML5-History-Management.html
  • #18 Build by MadsKristensen van Microsoft, van Web Essentials etc.