Package Exports
- timeout-idle-promise
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (timeout-idle-promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
timeout-idle-promise
Detects when a promise is idle (does not create asynchronous events) for longer than permitted amount of time.
API
import {
timeoutIdlePromise,
TimeoutError,
} from 'timeout-idle-promise';
/**
* @param {Function} promiseFactory
* @param {number} maximumIdleTime Idle timeout in milliseconds.
* @throws TimeoutError
*/
timeoutIdlePromise(promiseFactory);
Example Usage
// Rejected with Idle promise timeout.
timeoutIdlePromise(() => {
return new Promise((resolve) => {
});
}, 1000);
// Resolved.
timeoutIdlePromise(() => {
return new Promise((resolve) => {
setTimeout(() => {
setTimeout(() => {
setTimeout(() => {
resolve();
}, 500);
}, 500);
}, 500);
});
}, 1000);