@thi.ng/atom
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -6,2 +6,19 @@ # Change Log | ||
<a name="0.5.0"></a> | ||
# [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@0.4.1...@thi.ng/atom@0.5.0) (2018-02-01) | ||
### Bug Fixes | ||
* **atom:** cursor swap() return type ([36cc956](https://github.com/thi-ng/umbrella/commit/36cc956)) | ||
* **atom:** truncate redo stack in record(), swap() return type ([8218814](https://github.com/thi-ng/umbrella/commit/8218814)) | ||
### Features | ||
* **atom:** add History.canUndo/Redo() ([c5b6e0f](https://github.com/thi-ng/umbrella/commit/c5b6e0f)) | ||
<a name="0.4.1"></a> | ||
@@ -8,0 +25,0 @@ ## [0.4.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@0.4.0...@thi.ng/atom@0.4.1) (2018-02-01) |
@@ -16,3 +16,3 @@ import { IID, IRelease, Watch } from "@thi.ng/api/api"; | ||
reset(val: T): T; | ||
swap(fn: SwapFn<T>, ...args: any[]): any; | ||
swap(fn: SwapFn<T>, ...args: any[]): T; | ||
addWatch(id: string, fn: Watch<T>): boolean; | ||
@@ -19,0 +19,0 @@ removeWatch(id: string): boolean; |
@@ -22,2 +22,4 @@ import { Predicate2, Watch } from "@thi.ng/api/api"; | ||
constructor(state: IAtom<T>, maxLen?: number, changed?: Predicate2<T>); | ||
canUndo(): boolean; | ||
canRedo(): boolean; | ||
/** | ||
@@ -58,3 +60,3 @@ * Clears history & future stacks | ||
*/ | ||
swap(fn: SwapFn<T>, ...args: any[]): any; | ||
swap(fn: SwapFn<T>, ...args: any[]): T; | ||
/** | ||
@@ -61,0 +63,0 @@ * Records given state in history. This method is only needed when |
@@ -22,2 +22,8 @@ "use strict"; | ||
} | ||
canUndo() { | ||
return this.history.length > 0; | ||
} | ||
canRedo() { | ||
return this.future.length > 0; | ||
} | ||
/** | ||
@@ -97,2 +103,3 @@ * Clears history & future stacks | ||
this.history.push(arguments.length > 0 ? state : this.state.deref()); | ||
this.future.length = 0; | ||
} | ||
@@ -99,0 +106,0 @@ /** |
{ | ||
"name": "@thi.ng/atom", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "Mutable wrapper for a immutable values", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -19,2 +19,4 @@ # @thi.ng/atom | ||
**More advanced & complete example projects can be found in the [/examples](https://github.com/thi-ng/umbrella/tree/master/examples) directory** | ||
### Atom | ||
@@ -21,0 +23,0 @@ |
35456
580
84