MCPcopy Index your code
hub / github.com/anomalyco/opencode / runCleanup

Function runCleanup

packages/opencode/src/plugin/tui/runtime.ts:206–226  ·  view source on GitHub ↗
(fn: () => unknown, ms: number)

Source from the content-addressed store, hash-verified

204type CleanupResult = { type: "ok" } | { type: "error"; error: unknown } | { type: "timeout" }
205
206function runCleanup(fn: () => unknown, ms: number): Promise<CleanupResult> {
207 return new Promise((resolve) => {
208 const timer = setTimeout(() => {
209 resolve({ type: "timeout" })
210 }, ms)
211
212 Promise.resolve()
213 .then(fn)
214 .then(
215 () => {
216 resolve({ type: "ok" })
217 },
218 (error) => {
219 resolve({ type: "error", error })
220 },
221 )
222 .finally(() => {
223 clearTimeout(timer)
224 })
225 })
226}
227
228function isTheme(value: unknown) {
229 if (!isRecord(value)) return false

Callers 1

disposeFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected