@ima/core
Version:
IMA.js framework for isomorphic javascript application
77 lines • 2.04 kB
TypeScript
import { PageState, PageStateManager } from './PageStateManager';
import { StateEvents } from './StateEvents';
import { Dispatcher } from '../../event/Dispatcher';
import { AnyParameters } from '../../types';
export interface PageStateDispatcherEvents {
[StateEvents.AFTER_CHANGE_STATE]: {
newState: AnyParameters;
};
[StateEvents.BEFORE_CHANGE_STATE]: {
newState: AnyParameters;
oldState: AnyParameters;
patchState: AnyParameters | null;
};
}
/**
* The implementation of the {@link PageStateManager} interface.
*/
export declare class PageStateManagerImpl<S extends PageState = {}> extends PageStateManager<S> {
private _cursor;
private _dispatcher;
private _ongoingTransaction;
private _statePatchQueue;
private _states;
static get $dependencies(): (typeof Dispatcher)[];
/**
* Initializes the page state manager.
*
* @param {Dispatcher} dispatcher Dispatcher fires events to app.
*/
constructor(dispatcher: Dispatcher);
/**
* @inheritDoc
*/
clear(): void;
/**
* @inheritDoc
*/
setState<K extends keyof S>(patchState: Pick<S, K> | S | null): void | number;
/**
* @inheritDoc
*/
getState(): S;
/**
* @inheritDoc
*/
getAllStates(): S[];
/**
* @inheritDoc
*/
getTransactionStatePatches(): (Pick<S, any> | S | null)[];
/**
* @inheritDoc
*/
beginTransaction(): void;
/**
* @inheritDoc
*/
commitTransaction(): void;
/**
* @inheritDoc
*/
cancelTransaction(): void;
/**
* Erase the oldest state from storage only if it exceed max
* defined size of history.
*/
_eraseExcessHistory(): void;
/**
* Push new state to history storage.
*/
_pushToHistory(newState: S): void;
/**
* Call registered callback function on (@link onChange) with newState.
*/
_callOnChangeCallback(newState: S): void;
}
//# sourceMappingURL=PageStateManagerImpl.d.ts.map