UNPKG

ldx-widgets

Version:

widgets

40 lines (35 loc) 1.3 kB
/* 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 */ (function() { module.exports = { completeNavigation: function() { var ref; return (ref = this.pendingTransition) != null ? ref.retry() : void 0; }, statics: { willTransitionFrom: function(transition, component) { if (typeof console !== "undefined" && console !== null) { console.log('calling willTransitionFrom'); } if (typeof console !== "undefined" && console !== null) { console.log('show state: ', component.state.showAnimatedContent); } if (component.state.showAnimatedContent) { if (typeof console !== "undefined" && console !== null) { console.log('catching pending transition'); } component.setState({ showAnimatedContent: false }); component.pendingTransition = transition; return transition.abort(); } } } }; }).call(this);