Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
startProbe() {
const probe = () => {
let pos = this.translater.getComputedPosition()
this.hooks.trigger(this.hooks.eventTypes.move, pos)
// excute when transition ends
if (!this.pending) {
this.hooks.trigger(this.hooks.eventTypes.end, pos)
return
}
this.timer = requestAnimationFrame(probe)
}
cancelAnimationFrame(this.timer)
this.timer = requestAnimationFrame(probe)
}
stop() {
// still in transition
if (this.pending) {
this.setPending(false)
cancelAnimationFrame(this.timer)
const { x, y } = this.translater.getComputedPosition()
this.transitionTime()
this.translate({ x, y })
this.setForceStopped(true)
if (this.hooks.trigger(this.hooks.eventTypes.beforeForceStop, { x, y })) {
return
}
this.hooks.trigger(this.hooks.eventTypes.forceStop, { x, y })
}
}
}
disable() {
cancelAnimationFrame(this.animater.timer)
this.actions.enabled = false
}