hash support

This commit is contained in:
Radek Stepan 2013-08-21 17:21:23 +01:00
parent 20257e0875
commit 1d2f4b6e37
1 changed files with 8 additions and 4 deletions

View File

@ -28,7 +28,11 @@ route = ->
render 'body', 'info'
module.exports = ->
# Detect route changes.
window.addEventListener 'hashchange', route, no
# And route now.
do route
# Do we have browser support?
if 'onhashchange' of window and 'hash' of window.location
# Detect route changes.
window.addEventListener 'hashchange', route, no
# And route now.
return do route
render 'body', 'error', { text: 'URL fragment identifier not supported' }