UNPKG

wretch-middlewares

Version:

Middlewares for the wretch library

15 lines 448 B
/** * ## Delay middleware * * ### Delays the request by a specific amount of time. * * **Options** * * - *time* `milliseconds` * * > The request will be delayed by that amount of time. */ export var delay = function (time) { return function (next) { return function (url, opts) { return new Promise(function (res) { return setTimeout(function () { return res(next(url, opts)); }, time); }); }; }; }; //# sourceMappingURL=index.js.map