MCPcopy
hub / github.com/di-sukharev/opencommit / delay2

Function delay2

out/cli.cjs:75849–75879  ·  view source on GitHub ↗
(delayInMs, value, options)

Source from the content-addressed store, hash-verified

75847 }
75848 return next(request3);
75849 }
75850 };
75851}
75852
75853// node_modules/@azure/core-rest-pipeline/dist/esm/util/helpers.js
75854var StandardAbortMessage = "The operation was aborted.";
75855function delay2(delayInMs, value, options) {
75856 return new Promise((resolve, reject) => {
75857 let timer = void 0;
75858 let onAborted = void 0;
75859 const rejectOnAbort = () => {
75860 return reject(new AbortError((options === null || options === void 0 ? void 0 : options.abortErrorMsg) ? options === null || options === void 0 ? void 0 : options.abortErrorMsg : StandardAbortMessage));
75861 };
75862 const removeListeners = () => {
75863 if ((options === null || options === void 0 ? void 0 : options.abortSignal) && onAborted) {
75864 options.abortSignal.removeEventListener("abort", onAborted);
75865 }
75866 };
75867 onAborted = () => {
75868 if (timer) {
75869 clearTimeout(timer);
75870 }
75871 removeListeners();
75872 return rejectOnAbort();
75873 };
75874 if ((options === null || options === void 0 ? void 0 : options.abortSignal) && options.abortSignal.aborted) {
75875 return rejectOnAbort();
75876 }
75877 timer = setTimeout(() => {
75878 removeListeners();
75879 resolve(value);
75880 }, delayInMs);
75881 if (options === null || options === void 0 ? void 0 : options.abortSignal) {
75882 options.abortSignal.addEventListener("abort", onAborted);

Callers 2

sendRequestFunction · 0.85
beginRefreshFunction · 0.85

Calls 4

clearTimeoutFunction · 0.85
removeListenersFunction · 0.85
rejectOnAbortFunction · 0.85
setTimeoutFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…