blob: 474743273c3ca739b4429646ec134f71cbdfb42d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import {DEFERRED_PROMISE_DEBUG_TIMEOUT} from '../environment.js';
import {DeferredPromise, createDeferredPromise} from './DeferredPromise.js';
/**
* Creates and returns a deferred promise using DEFERRED_PROMISE_DEBUG_TIMEOUT
* if it's specified or a normal deferred promise otherwise.
*
* @internal
*/
export function createDebuggableDeferredPromise<T>(
message: string
): DeferredPromise<T> {
if (DEFERRED_PROMISE_DEBUG_TIMEOUT > 0) {
return createDeferredPromise({
message,
timeout: DEFERRED_PROMISE_DEBUG_TIMEOUT,
});
}
return createDeferredPromise();
}
|