グローバルイベントバスに追加したイベントは、呼び出すことで削除されview.unbindAll()
ますか?
1163 次
1 に答える
6
bindTo
マリオネットビュータイプのメソッドでそれらをバインドする場合、はい:
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(){
// ...
}
});
SomeViewのインスタンスを閉じると、イベントアグリゲーターイベントのバインドが解除されます。
于 2012-06-20T12:01:35.470 に答える