Skip to content

Commit

Permalink
Release. Bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
bryaningl3 committed Aug 13, 2023
1 parent 0cafd1d commit 18091e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@barchart/common-js",
"version": "4.29.0",
"version": "4.29.1",
"description": "Library of common JavaScript utilities",
"author": {
"name": "Bryan Ingle",
Expand Down
21 changes: 18 additions & 3 deletions test/SpecRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5606,11 +5606,26 @@ module.exports = (() => {
if (!(milliseconds > 0)) {
return Promise.reject('Unable to configure promise timeout, the "milliseconds" argument must be positive');
}
return Promise.race([promise, this.build((resolveCallback, rejectCallback) => {
setTimeout(() => {
let timeoutToken = null;
const timeoutPromise = this.build((resolveCallback, rejectCallback) => {
timeoutToken = setTimeout(() => {
rejectCallback(description || `Promise timed out after ${milliseconds} milliseconds`);
}, milliseconds);
})]);
});
const userPromise = Promise.resolve().then(() => {
return promise;
}).then(result => {
if (timeoutToken !== null) {
clearTimeout(timeoutToken);
}
return result;
}).catch(e => {
if (timeoutToken !== null) {
clearTimeout(timeoutToken);
}
return Promise.reject(e);
});
return Promise.race([userPromise, timeoutPromise]);
});
},
/**
Expand Down

0 comments on commit 18091e1

Please sign in to comment.