vue-async-computed
vue-async-computed copied to clipboard
Provide cancel method
Can you provide onCancel method as a parameter?
asyncComputed: {
sum (onCancel) {
const total = this.x + this.y
return new Promise(resolve =>
const timer = setTimeout(() => resolve(total), 1000)
onCancel(() => clearTimeout(timer))
)
}
}