oo-redux-utils
Advanced tools
Comparing version 1.23.1 to 1.23.2
@@ -8,8 +8,6 @@ "use strict"; | ||
var _AbstractAction2 = _interopRequireDefault(require("./AbstractAction")); | ||
var _AbstractAction3 = _interopRequireDefault(require("./AbstractAction")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
@@ -27,4 +25,2 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
@@ -34,6 +30,12 @@ | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
@@ -45,20 +47,34 @@ | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var AsyncAction = | ||
/*#__PURE__*/ | ||
function (_AbstractAction) { | ||
_inherits(AsyncAction, _AbstractAction); | ||
function AsyncAction(first, second) { | ||
var _this; | ||
_classCallCheck(this, AsyncAction); | ||
return _possibleConstructorReturn(_this); | ||
} | ||
return AsyncAction; | ||
}(_AbstractAction3.default); | ||
var AbstractDispatchingAction = | ||
/*#__PURE__*/ | ||
function (_AbstractAction) { | ||
_inherits(AbstractDispatchingAction, _AbstractAction); | ||
function (_AbstractAction2) { | ||
_inherits(AbstractDispatchingAction, _AbstractAction2); | ||
function AbstractDispatchingAction(stateNamespace, dispatchAction) { | ||
var _this; | ||
var _this2; | ||
_classCallCheck(this, AbstractDispatchingAction); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(AbstractDispatchingAction).call(this, stateNamespace)); | ||
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(AbstractDispatchingAction).call(this, stateNamespace)); | ||
_defineProperty(_assertThisInitialized(_this), "dispatchAction_", void 0); | ||
_defineProperty(_assertThisInitialized(_this2), "dispatchAction_", void 0); | ||
_this.dispatchAction_ = dispatchAction; | ||
return _this; | ||
_this2.dispatchAction_ = dispatchAction; | ||
return _this2; | ||
} | ||
@@ -74,6 +90,6 @@ | ||
value: function dispatchDelayedAction(action, delayInMillis) { | ||
var _this2 = this; | ||
var _this3 = this; | ||
setTimeout(function () { | ||
return _this2.dispatchAction_(action); | ||
return _this3.dispatchAction_(action); | ||
}, delayInMillis); | ||
@@ -84,6 +100,12 @@ } | ||
value: function dispatchAsyncAction(actionClass, promise) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
promise.then(function (arg) { | ||
return _this3.dispatchAction_(new actionClass(arg)); | ||
if (this.stateNamespace) { | ||
promise.then(function (result) { | ||
return _this4.dispatchAction_(new actionClass(_this4.stateNamespace, result)); | ||
}); | ||
} | ||
promise.then(function (result) { | ||
return _this4.dispatchAction_(new actionClass(result)); | ||
}); | ||
@@ -94,3 +116,3 @@ } | ||
value: function dispatchActionWithDi(diContainer, actionClass, otherArgs) { | ||
var _this4 = this; | ||
var _this5 = this; | ||
@@ -101,3 +123,3 @@ diContainer.create(actionClass, _objectSpread({}, otherArgs, { | ||
})).then(function (action) { | ||
return _this4.dispatchAction_(action); | ||
return _this5.dispatchAction_(action); | ||
}); | ||
@@ -108,3 +130,3 @@ } | ||
value: function dispatchActionsWithDi(diContainer, actionDefs) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
@@ -117,5 +139,5 @@ actionDefs.forEach(function (actionDef) { | ||
_this5.dispatchActionWithDi(diContainer, actionClass, otherArgs); | ||
_this6.dispatchActionWithDi(diContainer, actionClass, otherArgs); | ||
} else { | ||
_this5.dispatchAction(actionDef); | ||
_this6.dispatchAction(actionDef); | ||
} | ||
@@ -127,5 +149,5 @@ }); | ||
return AbstractDispatchingAction; | ||
}(_AbstractAction2.default); | ||
}(_AbstractAction3.default); | ||
exports.default = AbstractDispatchingAction; | ||
//# sourceMappingURL=AbstractDispatchingAction.js.map |
{ | ||
"name": "oo-redux-utils", | ||
"version": "1.23.1", | ||
"version": "1.23.2", | ||
"description": "Utility functions for Object-oriented Redux", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
52551
352