Ensure the return value of promiseTimeout always has .resolve and .reject (#550)
This commit is contained in:
parent
3089bb7908
commit
c800444a0d
@ -164,7 +164,10 @@ function getSetDifference(set1, set2) {
|
|||||||
|
|
||||||
function promiseTimeout(delay, resolveValue) {
|
function promiseTimeout(delay, resolveValue) {
|
||||||
if (delay <= 0) {
|
if (delay <= 0) {
|
||||||
return Promise.resolve(resolveValue);
|
const promise = Promise.resolve(resolveValue);
|
||||||
|
promise.resolve = () => {}; // NOP
|
||||||
|
promise.reject = () => {}; // NOP
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
let timer = null;
|
let timer = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user