asva-executors
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -7,3 +7,4 @@ import CacheExecutor from './modules/Executors/CacheExecutor'; | ||
import InfiniteLoader from './modules/Loaders/InfiniteLoader'; | ||
import RetrierExecutor from './modules/Loaders/RetrierExecutor'; | ||
import { InfiniteLoaderFactory } from './modules/Loaders/InfiniteLoaderFactory'; | ||
export { CacheExecutor, Executor, LadderExecutor, DebounceLoader, RepeatLoader, InfiniteLoader, InfiniteLoaderFactory }; | ||
export { CacheExecutor, Executor, LadderExecutor, DebounceLoader, RepeatLoader, InfiniteLoader, RetrierExecutor, InfiniteLoaderFactory }; |
@@ -88,7 +88,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
\**********************/ | ||
/*! exports provided: CacheExecutor, Executor, LadderExecutor, DebounceLoader, RepeatLoader, InfiniteLoader, InfiniteLoaderFactory */ | ||
/*! exports provided: CacheExecutor, Executor, LadderExecutor, DebounceLoader, RepeatLoader, InfiniteLoader, RetrierExecutor, InfiniteLoaderFactory */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_Executors_CacheExecutor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/Executors/CacheExecutor */ \"./src/modules/Executors/CacheExecutor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CacheExecutor\", function() { return _modules_Executors_CacheExecutor__WEBPACK_IMPORTED_MODULE_0__[\"default\"]; });\n\n/* harmony import */ var _modules_Executors_Executor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/Executors/Executor */ \"./src/modules/Executors/Executor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Executor\", function() { return _modules_Executors_Executor__WEBPACK_IMPORTED_MODULE_1__[\"default\"]; });\n\n/* harmony import */ var _modules_Executors_LadderExecutor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/Executors/LadderExecutor */ \"./src/modules/Executors/LadderExecutor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LadderExecutor\", function() { return _modules_Executors_LadderExecutor__WEBPACK_IMPORTED_MODULE_2__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_DebounceLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/Loaders/DebounceLoader */ \"./src/modules/Loaders/DebounceLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebounceLoader\", function() { return _modules_Loaders_DebounceLoader__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_RepeatLoader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/Loaders/RepeatLoader */ \"./src/modules/Loaders/RepeatLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RepeatLoader\", function() { return _modules_Loaders_RepeatLoader__WEBPACK_IMPORTED_MODULE_4__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_InfiniteLoader__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/Loaders/InfiniteLoader */ \"./src/modules/Loaders/InfiniteLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InfiniteLoader\", function() { return _modules_Loaders_InfiniteLoader__WEBPACK_IMPORTED_MODULE_5__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_InfiniteLoaderFactory__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/Loaders/InfiniteLoaderFactory */ \"./src/modules/Loaders/InfiniteLoaderFactory.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InfiniteLoaderFactory\", function() { return _modules_Loaders_InfiniteLoaderFactory__WEBPACK_IMPORTED_MODULE_6__[\"InfiniteLoaderFactory\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n//# sourceURL=webpack:///./src/index.ts?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_Executors_CacheExecutor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/Executors/CacheExecutor */ \"./src/modules/Executors/CacheExecutor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"CacheExecutor\", function() { return _modules_Executors_CacheExecutor__WEBPACK_IMPORTED_MODULE_0__[\"default\"]; });\n\n/* harmony import */ var _modules_Executors_Executor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/Executors/Executor */ \"./src/modules/Executors/Executor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"Executor\", function() { return _modules_Executors_Executor__WEBPACK_IMPORTED_MODULE_1__[\"default\"]; });\n\n/* harmony import */ var _modules_Executors_LadderExecutor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/Executors/LadderExecutor */ \"./src/modules/Executors/LadderExecutor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"LadderExecutor\", function() { return _modules_Executors_LadderExecutor__WEBPACK_IMPORTED_MODULE_2__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_DebounceLoader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/Loaders/DebounceLoader */ \"./src/modules/Loaders/DebounceLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"DebounceLoader\", function() { return _modules_Loaders_DebounceLoader__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_RepeatLoader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/Loaders/RepeatLoader */ \"./src/modules/Loaders/RepeatLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RepeatLoader\", function() { return _modules_Loaders_RepeatLoader__WEBPACK_IMPORTED_MODULE_4__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_InfiniteLoader__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/Loaders/InfiniteLoader */ \"./src/modules/Loaders/InfiniteLoader.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InfiniteLoader\", function() { return _modules_Loaders_InfiniteLoader__WEBPACK_IMPORTED_MODULE_5__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_RetrierExecutor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/Loaders/RetrierExecutor */ \"./src/modules/Loaders/RetrierExecutor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RetrierExecutor\", function() { return _modules_Loaders_RetrierExecutor__WEBPACK_IMPORTED_MODULE_6__[\"default\"]; });\n\n/* harmony import */ var _modules_Loaders_InfiniteLoaderFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/Loaders/InfiniteLoaderFactory */ \"./src/modules/Loaders/InfiniteLoaderFactory.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"InfiniteLoaderFactory\", function() { return _modules_Loaders_InfiniteLoaderFactory__WEBPACK_IMPORTED_MODULE_7__[\"InfiniteLoaderFactory\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n//# sourceURL=webpack:///./src/index.ts?"); | ||
@@ -133,2 +133,14 @@ /***/ }), | ||
/***/ "./src/modules/Helpers/AsyncHelpers.ts": | ||
/*!*********************************************!*\ | ||
!*** ./src/modules/Helpers/AsyncHelpers.ts ***! | ||
\*********************************************/ | ||
/*! exports provided: default */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\nvar AsyncHelpers = /** @class */ (function () {\r\n function AsyncHelpers() {\r\n }\r\n AsyncHelpers.sleep = function (ms) {\r\n return new Promise(function (resolve) { return setTimeout(resolve, ms); });\r\n };\r\n return AsyncHelpers;\r\n}());\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (AsyncHelpers);\r\n\n\n//# sourceURL=webpack:///./src/modules/Helpers/AsyncHelpers.ts?"); | ||
/***/ }), | ||
/***/ "./src/modules/Loaders/DebounceLoader.ts": | ||
@@ -192,2 +204,14 @@ /*!***********************************************!*\ | ||
/***/ }), | ||
/***/ "./src/modules/Loaders/RetrierExecutor.ts": | ||
/*!************************************************!*\ | ||
!*** ./src/modules/Loaders/RetrierExecutor.ts ***! | ||
\************************************************/ | ||
/*! exports provided: default */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Helpers_AsyncHelpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Helpers/AsyncHelpers */ \"./src/modules/Helpers/AsyncHelpers.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [0, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\n\r\nvar RetrierExecutor = /** @class */ (function () {\r\n function RetrierExecutor(command, timeout, maxTime) {\r\n if (timeout === void 0) { timeout = 100; }\r\n if (maxTime === void 0) { maxTime = 1000; }\r\n this.iterationCount = 0;\r\n this.command = command;\r\n this.timeout = timeout;\r\n this.maxTime = maxTime;\r\n }\r\n Object.defineProperty(RetrierExecutor.prototype, \"timeElapsed\", {\r\n get: function () {\r\n return this.timeout * this.iterationCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n RetrierExecutor.prototype.takesTooLong = function () {\r\n return this.timeElapsed > this.maxTime;\r\n };\r\n RetrierExecutor.prototype.run = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var result;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.iterationCount = 0;\r\n result = this.command();\r\n _a.label = 1;\r\n case 1:\r\n if (!!result) return [3 /*break*/, 3];\r\n return [4 /*yield*/, _Helpers_AsyncHelpers__WEBPACK_IMPORTED_MODULE_0__[\"default\"].sleep(this.timeout)];\r\n case 2:\r\n _a.sent();\r\n this.iterationCount++;\r\n if (this.takesTooLong()) {\r\n throw new Error(\"Max time (\" + this.maxTime + \") elapsed.\");\r\n }\r\n result = this.command();\r\n return [3 /*break*/, 1];\r\n case 3: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return RetrierExecutor;\r\n}());\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (RetrierExecutor);\r\n\n\n//# sourceURL=webpack:///./src/modules/Loaders/RetrierExecutor.ts?"); | ||
/***/ }) | ||
@@ -194,0 +218,0 @@ |
{ | ||
"name": "asva-executors", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Helper classes for your async flow control", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -7,2 +7,3 @@ import CacheExecutor from './modules/Executors/CacheExecutor' | ||
import InfiniteLoader from './modules/Loaders/InfiniteLoader' | ||
import RetrierExecutor from './modules/Loaders/RetrierExecutor' | ||
import { InfiniteLoaderFactory } from './modules/Loaders/InfiniteLoaderFactory' | ||
@@ -17,3 +18,4 @@ | ||
InfiniteLoader, | ||
RetrierExecutor, | ||
InfiniteLoaderFactory, | ||
} |
73828
39
1033