## Modules
histable
## External * [Immutable](#external_Immutable) ## histable **Example** ```javascript const histable = require('histable') const history = histable.create() history.push(1) history.push(2) history.push(3) history.undo() // 2 history.undo() // 1 history.undo() // undefined ``` * [histable](#module_histable) * _static_ * [.create([limit])](#module_histable.create) ⇒ History * _inner_ * [~History](#module_histable..History) * [new History([limit])](#new_module_histable..History_new) * [.canUndo](#module_histable..History+canUndo) ⇒ boolean * [.canRedo](#module_histable..History+canRedo) ⇒ boolean * [.push(...value)](#module_histable..History+push) ⇒ History * [.redo()](#module_histable..History+redo) ⇒ [Immutable](#external_Immutable) * [.undo()](#module_histable..History+undo) ⇒ [Immutable](#external_Immutable) * [.log()](#module_histable..History+log) ### histable.create([limit]) ⇒ History Creates a new history object **Kind**: static method of [histable](#module_histable) | Param | Type | Description | | --- | --- | --- | | [limit] | number | Sets the maximum number of [undo](undo) operations that one can perform. Prevents the system from causing a memory leaks because of keeping an infinitely large history. | ### histable~History Creates a new [History](History) **Kind**: inner class of [histable](#module_histable) * [~History](#module_histable..History) * [new History([limit])](#new_module_histable..History_new) * [.canUndo](#module_histable..History+canUndo) ⇒ boolean * [.canRedo](#module_histable..History+canRedo) ⇒ boolean * [.push(...value)](#module_histable..History+push) ⇒ History * [.redo()](#module_histable..History+redo) ⇒ [Immutable](#external_Immutable) * [.undo()](#module_histable..History+undo) ⇒ [Immutable](#external_Immutable) * [.log()](#module_histable..History+log) #### new History([limit]) | Param | Type | Default | Description | | --- | --- | --- | --- | | [limit] | number | 100 | Limits the maximum number of [undo](undo) operations. | #### history.canUndo ⇒ boolean Determines if [undo](undo) is possible or not **Kind**: instance property of [History](#module_histable..History) #### history.canRedo ⇒ boolean Determines if [redo](redo) is possible or not **Kind**: instance property of [History](#module_histable..History) #### history.push(...value) ⇒ History Adds the `value` to the history data structure. Addition only happens if the new value is not the same as the last one. **Kind**: instance method of [History](#module_histable..History) | Param | Type | Description | | --- | --- | --- | | ...value | [Immutable](#external_Immutable) | the [Immutable](#external_Immutable) that needs to be saved. | #### history.redo() ⇒ [Immutable](#external_Immutable) Moves the state one step forward if possible **Kind**: instance method of [History](#module_histable..History) #### history.undo() ⇒ [Immutable](#external_Immutable) Moves the state one step backwords if possible **Kind**: instance method of [History](#module_histable..History) #### history.log() A logging Util to view whats in the history data structure **Kind**: instance method of [History](#module_histable..History) ## Immutable The module works only when an immutable object is being pushed. This helps in detecting changes faster and also pushing it on the stack only if there is a real change. Immutable JS is one such library, but you can use it any other immutable library such as — [seamless-immutable](https://github.com/rtfeldman/seamless-immutable) or even the native immutables such as `string` , `Boolean`, `RegEx` etc. **Kind**: global external **See**: [https://facebook.github.io/immutable-js](https://facebook.github.io/immutable-js)