typedux
Version:
Slightly adjusted Redux (awesome by default) for TS
50 lines • 1.33 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.InternalState = void 0;
const constants_1 = require("../constants");
class InternalState {
/**
* Create a new internal state
*/
constructor(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)}}
*/
static fromJS(o = {}) {
if (o instanceof InternalState)
return o;
const state = new InternalState(), { pendingActions = {} } = o;
return Object.assign(state, { pendingActions });
}
/**
* Returns empty object - can not be serialized
*/
toJS() {
return this;
}
}
exports.InternalState = InternalState;
InternalState.Key = constants_1.INTERNAL_KEY;
//# sourceMappingURL=InternalState.js.map
;