history-helper
v1.1.1
Published
history-helper
Downloads
12
Readme
history-helper
history-helper
Install
yarn add history-helper
Usage
import HistoryHelper from 'history-helper';
/**
* storeKey [string] optional - 设置state[key]
* storeHistory [History] optional - 设置指定的history
**/
const historyHelper = new HistoryHelper(storeKey, storeHistory);
/** apis **/
historyHelper.setState(state: any);
historyHelper.getState()
// deep merge, see: lodash.merge
historyHelper.mergeState(...state: object[]);
// shallow merge, use lodash.assign
historyHelper.shallowMergeState(...state: object[]);
historyHelper.clearState();
historyHelper.getValue(path: string, defaultValue: any = null);