diff options
author | Thomas Davis <thomasalwyndavis@gmail.com> | 2012-04-28 13:01:31 +1000 |
---|---|---|
committer | Thomas Davis <thomasalwyndavis@gmail.com> | 2012-04-28 13:01:31 +1000 |
commit | 663d44f98d52a8153d1259e90f009d5f0a6d4845 (patch) | |
tree | 1fd791d7ddcbfd137b6d9302ccb4f1f0f6e6bb71 /examples/infinite-scroll/js/router.js | |
parent | ab807ffe21c6439f2cdd5f3d3df8cd59f9cb12a6 (diff) | |
download | backbonetutorials-663d44f98d52a8153d1259e90f009d5f0a6d4845.zip backbonetutorials-663d44f98d52a8153d1259e90f009d5f0a6d4845.tar.gz backbonetutorials-663d44f98d52a8153d1259e90f009d5f0a6d4845.tar.bz2 |
infinite scroll
Diffstat (limited to 'examples/infinite-scroll/js/router.js')
-rw-r--r-- | examples/infinite-scroll/js/router.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/infinite-scroll/js/router.js b/examples/infinite-scroll/js/router.js new file mode 100644 index 0000000..2f65042 --- /dev/null +++ b/examples/infinite-scroll/js/router.js @@ -0,0 +1,29 @@ +// Filename: router.js +define([ + 'jquery', + 'underscore', + 'backbone', + 'vm' +], function ($, _, Backbone, Vm) { + var AppRouter = Backbone.Router.extend({ + routes: { + '*actions': 'defaultAction' // All urls will trigger this route + } + }); + + var initialize = function(options){ + var appView = options.appView; + var router = new AppRouter(options); + + router.on('route:defaultAction', function (actions) { + require(['views/dashboard/page'], function (DashboardPage) { + var dashboardPage = Vm.create(appView, 'DashboardPage', DashboardPage); + dashboardPage.render(); + }); + }); + + }; + return { + initialize: initialize + }; +}); |