@common.js/p-timeout 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +1 -1
- package/index.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
The [p-timeout](https://www.npmjs.com/package/p-timeout) package exported as CommonJS modules.
|
|
4
4
|
|
|
5
|
-
Exported from [p-timeout@6.1.
|
|
5
|
+
Exported from [p-timeout@6.1.1](https://www.npmjs.com/package/p-timeout/v/6.1.1) using https://github.com/etienne-martin/common.js.
|
package/index.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ const delayedPromise = () => setTimeout(200);
|
|
|
136
136
|
await pTimeout(delayedPromise(), {
|
|
137
137
|
milliseconds: 50,
|
|
138
138
|
fallback: () => {
|
|
139
|
-
return pTimeout(delayedPromise(), 300);
|
|
139
|
+
return pTimeout(delayedPromise(), {milliseconds: 300});
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
```
|
package/index.js
CHANGED
|
@@ -339,6 +339,8 @@ function pTimeout(promise, options) {
|
|
|
339
339
|
reject(getAbortedReason(signal));
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
|
+
// We create the error outside of `setTimeout` to preserve the stack trace.
|
|
343
|
+
var timeoutError = new TimeoutError();
|
|
342
344
|
timer = customTimers.setTimeout.call(undefined, function() {
|
|
343
345
|
if (fallback) {
|
|
344
346
|
try {
|
|
@@ -356,8 +358,8 @@ function pTimeout(promise, options) {
|
|
|
356
358
|
} else if (_instanceof(message, Error)) {
|
|
357
359
|
reject(message);
|
|
358
360
|
} else {
|
|
359
|
-
|
|
360
|
-
reject(
|
|
361
|
+
timeoutError.message = message !== null && message !== void 0 ? message : "Promise timed out after ".concat(milliseconds, " milliseconds");
|
|
362
|
+
reject(timeoutError);
|
|
361
363
|
}
|
|
362
364
|
}, milliseconds);
|
|
363
365
|
_asyncToGenerator(function() {
|