Skip to content

niuba/ngrx-history

Repository files navigation

ngrx-history

codecov CircleCI

English | 简体中文

An redo/undo library on @ngrx/store. According to the redux-undo modification,the function is basically the same as the redux-undo@1.0.0-beta7. The test code is also from redux-undo (since the Slices are not used, this part of the test code has been removed)。

Installation

npm install --save ngrx-history

Usage

import { undoable } from 'ngrx-history';

export const counterReducer: ActionReducer<number, AppActions.UnionAction> = (
  state = 0,
  action
) => {
  switch (action.type) {
    case AppActions.ActionTypes.INCREMENT:
      return state + 1;
    case AppActions.ActionTypes.DECREMENT:
      return state - 1;
    default:
      return state;
  }
};

export const undoableCounterReducer = undoable(counterReducer, {
  limit: 3
});

More Information

redux-undo

About

An redo/undo library on @ngrx/store.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published