ldx-widgets
Version:
widgets
22 lines (18 loc) • 852 B
text/coffeescript
This mixin catches a router transition and saves it
as @pendingTransition on the component being transitioned out.
This allows it to be retried in @completeNavigation, which should
be call in @componentDidLeave by the component whose animation is being waited on
@completeNavigation can be passed down the chain or called on the component directlyy
module.exports =
completeNavigation: -> @pendingTransition?.retry()
statics:
willTransitionFrom: (transition, component) ->
console?.log 'calling willTransitionFrom'
console?.log 'show state: ', component.state.showAnimatedContent
if component.state.showAnimatedContent
console?.log 'catching pending transition'
component.setState {showAnimatedContent: no}
component.pendingTransition = transition
transition.abort()