Backbone.Router
ルーティングを実行する前と後の両方にイベントが存在しますか? 私のアプリは動作しjQuery.mobile
、ルートが実行される前に $.mobile.changePage への呼び出しが必要であり、コントローラーでは $.activePage によって現在表示されているページにアクセスできます。コントローラーのアクションが完了create
したら、ドキュメントでイベントをトリガーして、新しく作成された $.mobile 要素によって「強化」される必要があります。私はこれを交換して行いましたloadUrl
Backbone.history.loadUrl = ( function( old ){
return function() {
Router.trigger("all:before");
old.apply( Backbone.history, arguments );
Router.trigger("all:after" );
}
})( Backbone.history.loadUrl );
//Router.initialize
initialize: function() {
this.bind( "all:before", function( ) {
$.mobile.changePage( window.location.hash.split( "/" )[0] || "home", { changeHash:false} );
});
this.bind( "all:after", function() {
$.mobile.activePage.trigger('create');
});
}
このような組み込みイベントはありますか?