我想在backbone.navigate 调用之后运行一个函数(以呈现flash 消息)。是否可以?我目前连接到所有事件并检查事件名称是否以“路由:”开头。但这触发得太早了,在我的消息被添加之前......所以我正在考虑在路线完成后运行
# intercept all router navigate and render flash messages if any
renderFlashMessengesOnNavigate = (evt) =>
if evt.indexOf("route:") is 0
console.log "rendering messages after route ..."
@flashMessenger.render()
window.appRouter.bind "all", renderFlashMessengesOnNavigate
window.authRouter.bind "all", renderFlashMessengesOnNavigate
window.userRouter.bind "all", renderFlashMessengesOnNavigate