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 4ae6a7fd_ef65_6ba8_6ac4_230f87e2bf0a["waitForUpdate()"] c4611146_2d9c_334d_478d_8cad5a9e4b34["wait-for-update.ts"] 4ae6a7fd_ef65_6ba8_6ac4_230f87e2bf0a -->|defined in| c4611146_2d9c_334d_478d_8cad5a9e4b34 5c3b7101_6ffe_caf2_05fe_5bf5dc7fc870["timeout()"] 4ae6a7fd_ef65_6ba8_6ac4_230f87e2bf0a -->|calls| 5c3b7101_6ffe_caf2_05fe_5bf5dc7fc870 style 4ae6a7fd_ef65_6ba8_6ac4_230f87e2bf0a 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