ChangeHistory for ConboJS 4
The ChangeHistory
class is a simple object state history manager for ConboJS that enables you to navigate back and forward through the history of every property change made to any object that extends the EventDispatcher
class, including Hash
, Application
and View
, effectively making it possible to return to any of an object's past states.
The ChangeHistory
class can be imported as an AMD, CommonJS or global module.
API
The ChangeHistory
class is modelled on the built-in browser History
class, offering the following properties and methods:
back()
moves back 1 step into historyforward()
moved forward 1 step in hisyorygo(n)
moves n
steps backwards or forwards in historycurrentIndex
is the current place in historybeforeFirst
indicates whether you are at a point in history before any changes were madeatLast
indicates that you are at the end of history
Getting started
Initialising ChangeHistory
for an object couldn't be easier:
var history = new ChangeHistory(obj);