UNPKG

typedux

Version:

Slightly adjusted Redux (awesome by default) for TS

63 lines 2.14 kB
(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports", "../constants"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InternalState = void 0; var constants_1 = require("../constants"); var InternalState = /** @class */ (function () { /** * Create a new internal state */ function InternalState(o) { if (o === void 0) { o = {}; } this.type = constants_1.INTERNAL_KEY; /** * All pending actions */ this.pendingActions = {}; /** * Total actions executed */ this.totalActionCount = 0; /** * Pending action count */ this.pendingActionCount = 0; /** * Has pending actions currently ? */ this.hasPendingActions = false; Object.assign(this, o); } /** * Deserialize * * @param o * @returns {InternalState&U&{pendingActions: (Map<any, any>|Map<string, any>|any)}} */ InternalState.fromJS = function (o) { if (o === void 0) { o = {}; } if (o instanceof InternalState) return o; var state = new InternalState(), _a = o.pendingActions, pendingActions = _a === void 0 ? {} : _a; return Object.assign(state, { pendingActions: pendingActions }); }; /** * Returns empty object - can not be serialized */ InternalState.prototype.toJS = function () { return this; }; InternalState.Key = constants_1.INTERNAL_KEY; return InternalState; }()); exports.InternalState = InternalState; }); //# sourceMappingURL=InternalState.js.map