object-history
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
Gives birth to instances
initial
{Object}: The initial history pointoptions
{Object}: limit
: {Number}
Remember this many backward points
var History = require('object-history')
var initial = {foo: 'bar', name: 'victoria'}
var history = new History(initial, {limit: 33})
Add a history point object
obj
{Object}: The history point
history.add({
foo: 'bar',
bar: 'foo'
})
Go back one history point
Makes all backward history forgotten
Makes all forward history forgotten
Go forward one history point
returns
{Object}: "Current" history point
returns
{Number}: Number of history points backwards
returns
{Number}: Number of history points forward
License
Copyright © 2015 PolicyStat LLC
Released under the BSD-3-Clause license.