waitForUpdate() — vue Function Reference
Architecture documentation for the waitForUpdate() function in wait-for-update.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 6261caf5_370b_751f_f616_84854ac2462c["waitForUpdate()"] 7f6ed9c7_0eee_315d_2940_fda2cc028d1f["wait-for-update.ts"] 6261caf5_370b_751f_f616_84854ac2462c -->|defined in| 7f6ed9c7_0eee_315d_2940_fda2cc028d1f b1e77e1d_7323_589c_825e_9fd07f0902c3["timeout()"] 6261caf5_370b_751f_f616_84854ac2462c -->|calls| b1e77e1d_7323_589c_825e_9fd07f0902c3 style 6261caf5_370b_751f_f616_84854ac2462c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
test/helpers/wait-for-update.ts lines 21–75
const waitForUpdate = (initialCb: Job) => {
let end
const queue: Job[] = initialCb ? [initialCb] : []
function shift() {
const job = queue.shift()
if (queue.length) {
let hasError = false
try {
job!.wait ? job!(shift) : job!()
} catch (e) {
hasError = true
const done = queue[queue.length - 1]
if (done && done.fail) {
done.fail(e)
}
}
if (!hasError && !job!.wait) {
if (queue.length) {
Vue.nextTick(shift)
}
}
} else if (job && (job.fail || job === end)) {
job() // done
}
}
Vue.nextTick(() => {
if (!queue.length || (!end && !queue[queue.length - 1]!.fail)) {
throw new Error('waitForUpdate chain is missing .then(done)')
}
shift()
})
const chainer = {
then: nextCb => {
queue.push(nextCb)
return chainer
},
thenWaitFor: wait => {
if (typeof wait === 'number') {
wait = timeout(wait)
}
wait.wait = true
queue.push(wait)
return chainer
},
end: endFn => {
queue.push(endFn)
end = endFn
}
}
return chainer
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does waitForUpdate() do?
waitForUpdate() is a function in the vue codebase, defined in test/helpers/wait-for-update.ts.
Where is waitForUpdate() defined?
waitForUpdate() is defined in test/helpers/wait-for-update.ts at line 21.
What does waitForUpdate() call?
waitForUpdate() calls 1 function(s): timeout.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free