MCPcopy
hub / github.com/algolia/autocomplete / defer

Function defer

test/utils/defer.ts:1–5  ·  view source on GitHub ↗
(fn: () => TValue, timeout: number)

Source from the content-addressed store, hash-verified

1export function defer<TValue>(fn: () => TValue, timeout: number) {
2 return new Promise<TValue>((resolve) => {
3 setTimeout(() => resolve(fn()), timeout);
4 });
5}

Callers 10

metadata.test.tsFile · 0.90
debouncing.test.tsFile · 0.90
getSourcesFunction · 0.90
metadata.test.tsFile · 0.90
delayedGetSourcesFunction · 0.90
getItemsFunction · 0.90

Calls 1

resolveFunction · 0.85

Tested by 3

getSourcesFunction · 0.72
delayedGetSourcesFunction · 0.72
getItemsFunction · 0.72