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 timeOut_1 = __importDefault(require("./timeOut")); function timeOut(asyncFunction, millisecond) { if (!(this instanceof Promise)) throw TypeError('Promise.prototype.timeOut called on a non-Promise instance'); return this.then((0, timeOut_1.default)(asyncFunction, millisecond)); } (0, _helper_1.extendPrototype)(timeOut);