Transition Animations - Profiscience/ko-component-router GitHub Wiki
Transitions using a generator
ko.router.use(function * (ctx) {
yield
yield new Promise((resolve) => $(ctx.element).fadeIn(resolve))
yield new Promise((resolve) => $(ctx.element).fadeOut(resolve))
})
or in environments without generator support, use a lifecycle object
ko.router.use((ctx) => ({
afterRender(done) { $(ctx.element).fadeIn(done) },
beforeDispose(done) { $(ctx.element).fadeOut(done) }
}))