UNPKG

es-promise-ext

Version:

Native promise extensions for javascript and typescript.

14 lines (13 loc) 604 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const _helper_1 = require("../../_helper"); const retry_1 = __importDefault(require("./retry")); function retry(asyncFunction, count = 3, delay = 100) { if (!(this instanceof Promise)) throw TypeError('Promise.prototype.retry called on a non-Promise instance'); return this.then((0, retry_1.default)(asyncFunction, count, delay)); } (0, _helper_1.extendPrototype)(retry);