PageRenderTime 84ms CodeModel.GetById 41ms RepoModel.GetById 0ms app.codeStats 0ms

/src/filmstrip.app.js

https://bitbucket.org/gordonbrander/rjs-compile-test
JavaScript | 73 lines | 52 code | 14 blank | 7 comment | 0 complexity | 135addeff0e4e2a37321c66204819edd MD5 | raw file
  1. define([
  2. '$',
  3. 'underscore',
  4. 'backbone',
  5. // 'lib/browsing',
  6. 'views/widgetview',
  7. 'views/filmstripview',
  8. 'models/sitecollection',
  9. 'models/sitemodel',
  10. 'lib/decorateboot',
  11. 'xmessage'
  12. ], function (
  13. $,
  14. util,
  15. Backbone,
  16. // browsing,
  17. WidgetView,
  18. FilmstripView,
  19. SiteCollection,
  20. SiteModel,
  21. decorateBoot,
  22. xmessage
  23. ) {
  24. var global = window;
  25. var FilmStripAppRouter = Backbone.Router.extend({
  26. initialize: function () {
  27. // Create a new map view for app.
  28. this.appView = new WidgetView({
  29. el: $('#stacknav')
  30. });
  31. this.appView.render();
  32. }
  33. });
  34. var app = new FilmStripAppRouter();
  35. app.route('timeline*GET', 'new', decorateBoot(
  36. function () {
  37. var collection = new SiteCollection();
  38. var view = new FilmstripView({
  39. collection: collection
  40. });
  41. return {
  42. appView: this.appView,
  43. view: view
  44. };
  45. },
  46. function (booted) {
  47. booted.appView.widget('.controls', booted.view);
  48. // Populate data...
  49. booted.view.collection.fetch();
  50. }
  51. ));
  52. // Now that all of our routes are configured, start router listener.
  53. Backbone.history.start({pushState: true});
  54. xmessage.sendMessage("top", "ready", [{ source: window.name, type: "ready", data: { toSay: "nothing much" } }], function (result) {
  55. // Ignore the response
  56. });
  57. // Return app object for reference
  58. return app;
  59. });