Last active
January 28, 2016 20:07
-
-
Save somebody32/6ffccf72b4561af54488 to your computer and use it in GitHub Desktop.
router after extraction
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