UNPKG

typedux

Version:

Slightly adjusted Redux (awesome by default) for TS

46 lines 1.16 kB
import { INTERNAL_KEY } from "../constants"; export class InternalState { /** * Create a new internal state */ constructor(o = {}) { this.type = 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; } } InternalState.Key = INTERNAL_KEY; //# sourceMappingURL=InternalState.js.map