JavaScript Object history
Behind the scenes
For cloning, UltraDeepClone. For diff/apply, changeset.
Old browsers
Works in IE8 with es5-shim
. Perhaps IE7, as well.
API
History
Gives birth to instances
initial
{Object}: The initial history pointoptions
{Object}:limit
:{Number}
Remember this many backward points
var History = var initial = foo: 'bar' name: 'victoria'var history = initial limit: 33
.add
Add a history point object
obj
{Object}: The history point
history
.backward
Go back one history point
.forgetAllBackward
Makes all backward history forgotten
.forgetAllForward
Makes all forward history forgotten
.forward
Go forward one history point
.get
returns
{Object}: "Current" history point
.lengthBackward
returns
{Number}: Number of history points backwards
.lengthForward
returns
{Number}: Number of history points forward
License
Copyright © 2015 PolicyStat LLC
Released under the BSD-3-Clause license.