Created
February 5, 2017 21:06
-
-
Save Akryum/254a6d5da52995c48d0450446a8808ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const field = this._leaving ? 'leave' : 'enter' | |
const lastField = '_lastDuration_' + field | |
const duration = this.duration | |
const explicitDuration = parseDuration(( | |
duration !== null && | |
typeof duration === 'object' && | |
duration[field] | |
) || duration) | |
const el = child.elm | |
// Did explicit duration change? | |
if (el && explicitDuration !== this[lastField]) { | |
this[lastField] = explicitDuration | |
const cb = this._leaving ? el._leaveCb : el._enterCb | |
if (el._transitionTimer) { | |
clearTimeout(el._transitionTimer) | |
} | |
if (typeof explicitDuration !== 'undefined') { | |
const lastedDuration = Date.now() - el._transitionStarted | |
const remainingDuration = explicitDuration - lastedDuration | |
// console.log('remainingDuration', remainingDuration) | |
if (el._offTransitionEnds) { | |
el._offTransitionEnds() | |
el._offTransitionEnds = null | |
} | |
el._transitionTimer = setTimeout(cb, remainingDuration) | |
} else { | |
el._transitionTimer = null | |
el._offTransitionEnds = whenTransitionEnds(el, this.type, cb) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment