backbone.memento icon indicating copy to clipboard operation
backbone.memento copied to clipboard

Add keepState option to .restore()

Open codynguyen opened this issue 8 years ago • 0 comments

Hi,

This PR adds the keepState option for the .restore() call.

When you call .restore(), the default behaviour is pretty much the same as an "undo" feature. If I call .restore() 1 time more than I should, the model can be restored to even the point BEFORE it was synced with the server, which is not ideal in most (our) cases.

So this keepState option behaves like a "clear dirty" feature, only the "dirty" changes get cleared. Call .restore({keepState:true}) as many times as you want, and the model will always be restored to the state of the last .store().

codynguyen avatar Aug 12 '16 15:08 codynguyen