asva-executors
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -1,3 +0,12 @@ | ||
var asva-executors = | ||
/******/ (function(modules) { // webpackBootstrap | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else { | ||
var a = factory(); | ||
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; | ||
} | ||
})(window, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
@@ -83,3 +92,3 @@ /******/ var installedModules = {}; | ||
"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_Executors_RepeatExecutor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/Executors/RepeatExecutor */ \"./src/modules/Executors/RepeatExecutor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RepeatExecutor\", function() { return _modules_Executors_RepeatExecutor__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n//# sourceURL=webpack://asva-executors/./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_Executors_RepeatExecutor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/Executors/RepeatExecutor */ \"./src/modules/Executors/RepeatExecutor.ts\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"RepeatExecutor\", function() { return _modules_Executors_RepeatExecutor__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; });\n\n\r\n\r\n\r\n\r\n\r\n\n\n//# sourceURL=webpack:///./src/index.ts?"); | ||
@@ -96,3 +105,3 @@ /***/ }), | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Executor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Executor */ \"./src/modules/Executors/Executor.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n/**\r\n * This executor caches first run result and provides it for all subsequent calls.\r\n */\r\nvar CacheExecutor = /** @class */ (function (_super) {\r\n __extends(CacheExecutor, _super);\r\n function CacheExecutor() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.cachedPromise = null;\r\n return _this;\r\n }\r\n /**\r\n * Run command and cache promise.\r\n */\r\n CacheExecutor.prototype.run = function () {\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n if (!this.cachedPromise) {\r\n this.cachedPromise = _super.prototype.run.apply(this, parameters);\r\n }\r\n return this.cachedPromise;\r\n };\r\n /**\r\n * Run executor without cache. Promise will be put to cache though.\r\n */\r\n CacheExecutor.prototype.runFresh = function () {\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n this.cachedPromise = _super.prototype.run.apply(this, parameters);\r\n return this.cachedPromise;\r\n };\r\n /**\r\n * Just clean cache.\r\n */\r\n CacheExecutor.prototype.cleanCache = function () {\r\n this.cachedPromise = null;\r\n };\r\n return CacheExecutor;\r\n}(_Executor__WEBPACK_IMPORTED_MODULE_0__[\"default\"]));\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (CacheExecutor);\r\n\n\n//# sourceURL=webpack://asva-executors/./src/modules/Executors/CacheExecutor.ts?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Executor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Executor */ \"./src/modules/Executors/Executor.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n/**\r\n * This executor caches first run result and provides it for all subsequent calls.\r\n */\r\nvar CacheExecutor = /** @class */ (function (_super) {\r\n __extends(CacheExecutor, _super);\r\n function CacheExecutor() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.cachedPromise = null;\r\n return _this;\r\n }\r\n /**\r\n * Run command and cache promise.\r\n */\r\n CacheExecutor.prototype.run = function () {\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n if (!this.cachedPromise) {\r\n this.cachedPromise = _super.prototype.run.apply(this, parameters);\r\n }\r\n return this.cachedPromise;\r\n };\r\n /**\r\n * Run executor without cache. Promise will be put to cache though.\r\n */\r\n CacheExecutor.prototype.runFresh = function () {\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n this.cachedPromise = _super.prototype.run.apply(this, parameters);\r\n return this.cachedPromise;\r\n };\r\n /**\r\n * Just clean cache.\r\n */\r\n CacheExecutor.prototype.cleanCache = function () {\r\n this.cachedPromise = null;\r\n };\r\n return CacheExecutor;\r\n}(_Executor__WEBPACK_IMPORTED_MODULE_0__[\"default\"]));\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (CacheExecutor);\r\n\n\n//# sourceURL=webpack:///./src/modules/Executors/CacheExecutor.ts?"); | ||
@@ -109,3 +118,3 @@ /***/ }), | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\nvar Executor = /** @class */ (function () {\r\n function Executor(command) {\r\n /**\r\n * Currently running commands\r\n */\r\n this.runCount = 0; //\r\n /**\r\n * Last executor run happened without an error\r\n */\r\n this.wasLastRunFine = false; //\r\n /**\r\n * Executor was run at least once\r\n */\r\n this.wasRun = false;\r\n /**\r\n * Executor was run without throwing error at least once\r\n */\r\n this.wasRunFine = false;\r\n /**\r\n * Executor was run with thrown error at least once\r\n */\r\n this.wasRunBad = false;\r\n this.command = command;\r\n }\r\n Object.defineProperty(Executor.prototype, \"isRunning\", {\r\n /**\r\n * Command from this executor is currently running.\r\n */\r\n get: function () {\r\n return !!this.runCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @param parameters Arguments, will be passed down to command.\r\n * @returns {Promise<any>} Promise result is formed from whatever you returned from command.\r\n */\r\n Executor.prototype.run = function () {\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n this.beforeRun();\r\n var promise = this.command.apply(this, parameters);\r\n if (!(promise instanceof Promise)) {\r\n throw new Error('Executor command should return promise.');\r\n }\r\n this.afterRun(promise);\r\n return promise;\r\n };\r\n Executor.prototype.beforeRun = function () {\r\n this.runCount++;\r\n };\r\n Executor.prototype.afterRun = function (promise) {\r\n var _this = this;\r\n promise.then(function () {\r\n _this.runCount--;\r\n _this.setRunResultFlags(true);\r\n });\r\n promise.catch(function () {\r\n _this.runCount--;\r\n _this.setRunResultFlags(false);\r\n });\r\n };\r\n Executor.prototype.setRunResultFlags = function (success) {\r\n this.wasRun = true;\r\n this.wasLastRunFine = success;\r\n if (success) {\r\n this.wasRunFine = true;\r\n }\r\n if (!success) {\r\n this.wasRunBad = true;\r\n }\r\n };\r\n return Executor;\r\n}());\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (Executor);\r\n\n\n//# sourceURL=webpack://asva-executors/./src/modules/Executors/Executor.ts?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\nvar Executor = /** @class */ (function () {\r\n function Executor(command) {\r\n /**\r\n * Currently running commands\r\n */\r\n this.runCount = 0; //\r\n /**\r\n * Last executor run happened without an error\r\n */\r\n this.wasLastRunFine = false; //\r\n /**\r\n * Executor was run at least once\r\n */\r\n this.wasRun = false;\r\n /**\r\n * Executor was run without throwing error at least once\r\n */\r\n this.wasRunFine = false;\r\n /**\r\n * Executor was run with thrown error at least once\r\n */\r\n this.wasRunBad = false;\r\n this.command = command;\r\n }\r\n Object.defineProperty(Executor.prototype, \"isRunning\", {\r\n /**\r\n * Command from this executor is currently running.\r\n */\r\n get: function () {\r\n return !!this.runCount;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @param parameters Arguments, will be passed down to command.\r\n * @returns {Promise<any>} Promise result is formed from whatever you returned from command.\r\n */\r\n Executor.prototype.run = function () {\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n this.beforeRun();\r\n var promise = this.command.apply(this, parameters);\r\n if (!(promise instanceof Promise)) {\r\n throw new Error('Executor command should return promise.');\r\n }\r\n this.afterRun(promise);\r\n return promise;\r\n };\r\n Executor.prototype.beforeRun = function () {\r\n this.runCount++;\r\n };\r\n Executor.prototype.afterRun = function (promise) {\r\n var _this = this;\r\n promise.then(function () {\r\n _this.runCount--;\r\n _this.setRunResultFlags(true);\r\n });\r\n promise.catch(function () {\r\n _this.runCount--;\r\n _this.setRunResultFlags(false);\r\n });\r\n };\r\n Executor.prototype.setRunResultFlags = function (success) {\r\n this.wasRun = true;\r\n this.wasLastRunFine = success;\r\n if (success) {\r\n this.wasRunFine = true;\r\n }\r\n if (!success) {\r\n this.wasRunBad = true;\r\n }\r\n };\r\n return Executor;\r\n}());\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (Executor);\r\n\n\n//# sourceURL=webpack:///./src/modules/Executors/Executor.ts?"); | ||
@@ -122,3 +131,3 @@ /***/ }), | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Executor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Executor */ \"./src/modules/Executors/Executor.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n/**\r\n * This executor will chain requests ladder-like.\r\n * Last one will always be executed.\r\n * For skipped requests the promise will never be resolved.\r\n */\r\nvar LadderExecutor = /** @class */ (function (_super) {\r\n __extends(LadderExecutor, _super);\r\n function LadderExecutor() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.trigger = null;\r\n return _this;\r\n }\r\n LadderExecutor.prototype.run = function () {\r\n var _this = this;\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n if (!this.isRunning) {\r\n var promise = _super.prototype.run.apply(this, parameters);\r\n promise.then(function () {\r\n _this.trigger && _this.trigger();\r\n _this.trigger = null;\r\n });\r\n return promise;\r\n }\r\n return new Promise(function (resolve) {\r\n _this.trigger = function () { return _this.run.apply(_this, parameters).then(resolve); };\r\n });\r\n };\r\n return LadderExecutor;\r\n}(_Executor__WEBPACK_IMPORTED_MODULE_0__[\"default\"]));\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (LadderExecutor);\r\n\n\n//# sourceURL=webpack://asva-executors/./src/modules/Executors/LadderExecutor.ts?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Executor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Executor */ \"./src/modules/Executors/Executor.ts\");\nvar __extends = (undefined && undefined.__extends) || (function () {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return function (d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n})();\r\n\r\n/**\r\n * This executor will chain requests ladder-like.\r\n * Last one will always be executed.\r\n * For skipped requests the promise will never be resolved.\r\n */\r\nvar LadderExecutor = /** @class */ (function (_super) {\r\n __extends(LadderExecutor, _super);\r\n function LadderExecutor() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.trigger = null;\r\n return _this;\r\n }\r\n LadderExecutor.prototype.run = function () {\r\n var _this = this;\r\n var parameters = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n parameters[_i] = arguments[_i];\r\n }\r\n if (!this.isRunning) {\r\n var promise = _super.prototype.run.apply(this, parameters);\r\n promise.then(function () {\r\n _this.trigger && _this.trigger();\r\n _this.trigger = null;\r\n });\r\n return promise;\r\n }\r\n return new Promise(function (resolve) {\r\n _this.trigger = function () { return _this.run.apply(_this, parameters).then(resolve); };\r\n });\r\n };\r\n return LadderExecutor;\r\n}(_Executor__WEBPACK_IMPORTED_MODULE_0__[\"default\"]));\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (LadderExecutor);\r\n\n\n//# sourceURL=webpack:///./src/modules/Executors/LadderExecutor.ts?"); | ||
@@ -135,6 +144,7 @@ /***/ }), | ||
"use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\n/**\r\n * Runs command on timeout.\r\n * Don't forget to stop it or executor would run indefinitely.\r\n */\r\nvar RepeatExecutor = /** @class */ (function () {\r\n function RepeatExecutor(command, time) {\r\n this.time = 100;\r\n this.id = null;\r\n this.command = command;\r\n this.time = time;\r\n }\r\n RepeatExecutor.prototype.start = function () {\r\n if (!this.id) {\r\n this.id = setInterval(this.command, this.time);\r\n }\r\n };\r\n RepeatExecutor.prototype.stop = function () {\r\n if (this.id) {\r\n clearInterval(this.id);\r\n }\r\n this.id = null;\r\n };\r\n return RepeatExecutor;\r\n}());\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (RepeatExecutor);\r\n\n\n//# sourceURL=webpack://asva-executors/./src/modules/Executors/RepeatExecutor.ts?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/**\r\n * Runs command on timeout.\r\n * Don't forget to stop it or executor would run indefinitely.\r\n */\r\nvar RepeatExecutor = /** @class */ (function () {\r\n function RepeatExecutor(command, time) {\r\n this.time = 100;\r\n this.id = null;\r\n this.command = command;\r\n this.time = time;\r\n }\r\n RepeatExecutor.prototype.start = function () {\r\n if (!this.id) {\r\n this.id = setInterval(this.command, this.time);\r\n }\r\n };\r\n RepeatExecutor.prototype.stop = function () {\r\n if (this.id) {\r\n clearInterval(this.id);\r\n }\r\n this.id = null;\r\n };\r\n return RepeatExecutor;\r\n}());\r\n/* harmony default export */ __webpack_exports__[\"default\"] = (RepeatExecutor);\r\n\n\n//# sourceURL=webpack:///./src/modules/Executors/RepeatExecutor.ts?"); | ||
/***/ }) | ||
/******/ }); | ||
/******/ }); | ||
}); |
{ | ||
"name": "asva-executors", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Helper classes for your async flow control", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -27,3 +27,3 @@ const config = require('./config.js') | ||
publicPath: '/', | ||
library: 'asva-executors', | ||
libraryTarget: 'umd', | ||
}, | ||
@@ -30,0 +30,0 @@ module: { |
43045
800