ngrx-undo
This package contains undo functionality for @ngrx/store (4+). The goal of this package is described in this blogpost Cancellable optimistic updates in angular2 and redux written by Brecht Billiet
Installation
$ npm install --save ngrx-undo
Usage
The previous version of ngrx-undo was created for @ngrx/store 2 and was completely integrated with angular modules. Because the complete API got changed it seemed easier to keep it simple. For that reason we dropped the angular dependency and decided to keep the config a bit easier.
; // if you want to update the buffer (which defaults to 100)configureBufferSize150;
To undo an action, simply use the undo
action creator.
; // create an action; // dispatch itthis.store.dispatchaction; // undo the actionthis.store.dispatchundoaction;
A more concrete example could look like this:
; removewine: Wine: void