PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/dasher/javascript/collections/plugins.js

https://gitlab.com/karouf/heka
JavaScript | 58 lines | 25 code | 6 blank | 27 comment | 0 complexity | b47c698f40edfcaf69e163e27e2527c6 MD5 | raw file
  1. define(
  2. [
  3. "backbone",
  4. "models/plugin"
  5. ],
  6. function(Backbone, Plugin) {
  7. "use strict";
  8. /**
  9. * Plugins collection.
  10. *
  11. * @class Plugins
  12. * @constructor
  13. */
  14. var Plugins = Backbone.Collection.extend({
  15. model: Plugin,
  16. /**
  17. * Gets the Router plugin from the collection.
  18. *
  19. * @method getRouter
  20. *
  21. * @return {Plugin} Router plugin
  22. */
  23. getRouter: function() {
  24. return this.findWhere({ id: "Router" });
  25. },
  26. /**
  27. * Gets the InputRecycleChan plugin from the collection.
  28. *
  29. * @method getInputRecycleChan
  30. *
  31. * @return {Plugin} InputRecycleChan plugin
  32. */
  33. getInputRecycleChan: function() {
  34. return this.findWhere({ id: "inputRecycleChan" });
  35. },
  36. /**
  37. * Gets the InjectRecycleChan plugin from the collection.
  38. *
  39. * @method getInjectRecycleChan
  40. *
  41. * @return {Plugin} InjectRecycleChan plugin
  42. */
  43. getInjectRecycleChan: function() {
  44. return this.findWhere({ id: "injectRecycleChan" });
  45. },
  46. comparator: function(collection) {
  47. return(collection.get('Name'));
  48. }
  49. });
  50. return Plugins;
  51. }
  52. );