Unbind all events that a view adds to the app.vent

backbone.js, javascript, marionette

Solution

If you bind them with the `bindTo` method on the Marionette view types, yes:

SomeView = Backbone.Marionette.ItemView.extend({

  initialize: function(){
    // note the use of the 4th parameter. this is important when binding
    // to the App's event aggregator
    this.bindTo(MyApp.vent, "some:event", this.someCallback, this);
  },

  someCallback: function(){
    // ...
  }
});

Closing an instance of SomeView will unbind the event aggregator events, now.

Problem

Will the events that I added to the global event bus deleted by calling `view.unbindAll()`?

Original source