Last active
January 26, 2016 19:21
-
-
Save somebody32/33825a35470c804baf39 to your computer and use it in GitHub Desktop.
Initial Router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Backbone from 'backbone'; | |
import $ from 'jquery'; | |
export default Backbone.Router.extend({ | |
routes: { | |
'': 'home', | |
'main_app_part': 'mainAppPart', | |
'about': 'about', | |
'heavy(/:heavy_param)': 'heavy', | |
'*handleMissingRoute': 'handle404', | |
}, | |
home() { | |
$('#app').html("You're on the home page"); | |
}, | |
mainAppPart() { | |
$('#app').html("You're viewing a part of the main app, it is lightweight and very actively used"); | |
}, | |
about() { | |
$('#app').html("You're viewing the about page. It is full of graphics"); | |
}, | |
heavy(heavy_param) { | |
$('#app').html(`You're viewing that heavy app, heavy param from the URL is: ${heavy_param}`); | |
}, | |
handle404() { | |
alert('404'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment