$('button').click(function(){
App.vent.trigger("box:change");
});
App.BoxView = Backbone.View.extend({
initialize: function(options) {
this.listenTo( App.vent, "box:change", this.alter ); // animate, etc.
},
...
});
私はメイン ビューを持っています。
- イベントはすべてのボックスによって処理されます
- 私のすべての箱はいくつかのアニメーションで完成しました
これに頭を包むことはできません(長い仕事の日)...助けてください=)より良い練習は何ですか?
私はこのようなものを探しています:
App.MainView = Backbone.View.extend({
initialize: function(options) {
// when all the events are complete
this.listenTo( App.vent, "box:change" ).onComplete( this.rearrange_stuff );
// when all the animations are complete
this.listenTo( App.animationBuffer, "box:fadeOut" ).onComplete( this.rearrange_stuff );
},
...
});
更新:アプリケーションに長いチェーンのイベント - 完了 - イベント - 完了 (ループではない) がある場合、このキューを設定するより良い方法は何ですか?