import { MachineInputSource, MachineState, StateMachine } from './index'; import { IHistory } from './interfaces'; import { InputMapping } from './util'; /** * The HistoryManager class manages the state/history of a program. */ /** @ignore */ export declare class HistoryManager = StateMachine> implements IHistory { protected readonly _instance: M; protected readonly _inputSource?: I; protected readonly _inputMappings: InputMapping[]; private readonly _initialState; private _previousInputs; private _maxHistory; private _tick; private _nextState; private _records; /** * Constructor with an initial state. * @param _instance The state machine instance. * @param {S} _initialState The initial program state. * @param _inputSource Source for inputs. */ /** @ignore */ constructor(instance: M, initialState: S, inputSource?: I, inputMappings?: Set>); /** * Get the current tick number. * @returns {number} */ readonly tick: number; /** * Returns the next state being updated. * @returns {Partial} */ readonly nextState: Readonly & I>; /** * Returns the entire state history. * @returns {ReadonlyArray} */ readonly records: ReadonlyArray; /** * Return the maximum number of history states to keep. * @returns {number} */ /** * Limit the number of recorded history states. */ limit: number; /** * Returns the initial state. * @returns {Partial} */ readonly initialState: Readonly; /** * Returns the current state. * @returns {Partial} */ readonly currentState: Readonly; /** * Returns the previous state. * @returns {Partial} */ readonly previousState: Readonly; rewind(t: number, mutate?: Partial): false | (S & Readonly)[]; /** * Clears the state history. Rewinds to the beginning, and the rest of the * current tick will be ignored. */ clear(): void; /** @ignore */ _mutateTick(p: Partial): Readonly & I> & Partial; _nextTick(): void; /** * * @param {boolean} patchCurrent * @private */ protected _beginTick(patchCurrent?: boolean): void; protected _collectInputs(force?: boolean): Partial; }