PageRenderTime 36ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

/architecture-examples/backbone/js/routers/router.js

https://github.com/1manStartup/todomvc
JavaScript | 27 lines | 15 code | 7 blank | 5 comment | 2 complexity | 5d51a1ed3b17eedb1668445aaf9f92e5 MD5 | raw file
  1. var app = app || {};
  2. (function() {
  3. 'use strict';
  4. // Todo Router
  5. // ----------
  6. var Workspace = Backbone.Router.extend({
  7. routes:{
  8. '*filter': 'setFilter'
  9. },
  10. setFilter: function( param ) {
  11. // Set the current filter to be used
  12. window.app.TodoFilter = param.trim() || '';
  13. // Trigger a collection filter event, causing hiding/unhiding
  14. // of Todo view items
  15. window.app.Todos.trigger('filter');
  16. }
  17. });
  18. app.TodoRouter = new Workspace();
  19. Backbone.history.start();
  20. }());