method timeout rejection
Reject method (encapsulate in a promise) if it takes more than a set duration
Usage
Constructor defines a timeout in milliseconds.
const MethodTimeoutRejection = ; const methodTimeout = 1000;
Method timeoutRejection
wraps a callback in a promise and define a timeout in milliseconds.
If the callback return something in that time then it acts in the exact same way as
the original callback, otherwise it's rejected with a specific MethodTimeOutError
error.
methodTimeout;
Method hasExpired
just returns true if inside the timeoutRejection method, the global callback has timeout.