MCPcopy
hub / github.com/vitejs/vite / resolvedOrTimeout

Function resolvedOrTimeout

playground/cli/__tests__/serve.ts:148–159  ·  view source on GitHub ↗
(promise, ms, errorMessage)

Source from the content-addressed store, hash-verified

146
147// helper function that rejects with errorMessage if promise isn't settled within ms
148async function resolvedOrTimeout(promise, ms, errorMessage) {
149 let timer
150 return Promise.race([
151 promise,
152 new Promise((_, reject) => {
153 timer = setTimeout(() => reject(errorMessage), ms)
154 }),
155 ]).finally(() => {
156 clearTimeout(timer)
157 timer = null
158 })
159}

Callers 2

closeFunction · 0.70
startedOnPortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected