Tripod.js

Two-way data-binding is sooo 2009.

saveState and revert

saveState() and revert() allow you to take a snapshot of the state of your object and revert it back to the way it was when you last called saveState().

The use case that brought this about was pretty simple. What happens if you open up a form in a dialog box, the user makes some changes, then clicks the Cancel button? The user expects the changes they made to be canceled, too. (Reverted, actually.)

saveState()

Simply put, the saveState() method makes copy of all the data stored in your Tripod instance and stores it internally.

saveState() also returns the copy it made if you'd like to inspect it.

revert()

The revert() method uses the copy created by saveState() to return the Tripod object's data to its previous state.

Tripod is smart enough to only re-set attributes that have changed when you call revert(), which saves you a few milliseconds of DOM manipulation time.