arbor-timetravel
v0.1.0
Published
Provides time traveling functionality to Arbor stores
Downloads
5
Maintainers
Readme
Arbor Time Travel
Provides time traveling functionality to Arbor stores.
Getting Started
A simple Counter APP...
import Arbor from "arbor-store"
import timetravel from "arbor-timetravel"
const store = timetravel(new Arbor({
todos: []
}))
// retrieves the current time cursor value
store.timeline.cursor
// goes back one time unit
store.timeline.travel.step(-1)
// move forward one time unit
store.timeline.travel.step(1)
// travels to a specific point in time
store.timeline.travel.to(5)
// goes back to the beginning of time
store.timeline.travel.origin()
// travels to the last state change (present)
store.timeline.travel.present()
State Tree Time Travel
Arbor leverages Structural Sharing in order to perform state mutations. A new state tree is always created by applying the minimum amount of operations necessary to generate the new state. With this, a series of state snapshots may be recorded. This packages leverages that behavior in order to provide time traveling features for Arbor based stores. Checkout this proof of concept app for more insights: