Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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