javascript - Saving the lastest state of an entire application in JS -


i have interactive web based visualization. want allow users able undo while interacting visualization. noticed people suggest writing own undo function in case might difficult (so many different things keep track of). how can save last state of entire application after each interaction? idea?

thanks,

you use more state-driven approach , use react + redux, sounds have existing app don't want recreate.

in case, depends on data looks like. single json object? in case, clone object on , on "save" previous states.

you implement database , save copy of needed data timestamps and/or version numbers allow roll back. lead lot of duplication of data.

another approach keep track of events modify data, , opposite of event. basic example, add number 15 "total". if wanted undo that, subtract 15. however, works if performing operations on of data. if want apply different types of data, store event along previous value.

example: change name "bob" "jim". event object:

{   event: "stringchange",   prop: "name",   prev: "bob",   new: "jim" } 

this give need undo change.

lots of options here, depends on data looks , how manipulating it.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -