Code coverage report for src/marionette.controller.js

Statements: 100% (10 / 10)      Branches: 100% (4 / 4)      Functions: 100% (2 / 2)      Lines: 100% (10 / 10)     

All files » src/ » marionette.controller.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29            1 172 172   172 7       1           1   11 11 11      
// Marionette Controller
// ---------------------
//
// A multi-purpose object to use as a controller for
// modules and routers, and as a mediator for workflow
// and coordination of other objects, views, and more.
Marionette.Controller = function(options){
  this.triggerMethod = Marionette.triggerMethod;
  this.options = options || {};
 
  if (_.isFunction(this.initialize)){
    this.initialize(this.options);
  }
};
 
Marionette.Controller.extend = Marionette.extend;
 
// Controller Methods
// --------------
 
// Ensure it can trigger events with Backbone.Events
_.extend(Marionette.Controller.prototype, Backbone.Events, {
  close: function(){
    this.stopListening();
    this.triggerMethod("close");
    this.unbind();
  }
});