EtienneLem/commandz — pull request #2 by EtienneLem (2013-09-02 15:42:59+00:00)
Title: Storage mode

A way to store data as a history item.

These wouldn’t need up/down callbacks like a command, but you’d have to register a callback with `CommandZ.onStorageChange(function(data) { … })` and then it’s up to you to do whatever your app is doing with said data.

Typical use case would be to store JSON (i.e. JSON that your frontend uses to render/layout your app and sync with the backend) with `CommandZ.store({width: 100, height: 200})`) and then restore this state in the callback.

**Other enhancements**

- **Direct access**:
Unlike commands, you’d be able to go directly to a certain history item without having to go through all of the items in-between.
- **Threshold**:
One could also set a threshold so that it skips a few steps when a user is hammering CMD+Z.

Sounds good?