@etsoo/shared 1.1.31 → 1.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/cjs/types/EHistory.d.ts +4 -0
- package/lib/cjs/types/EHistory.js +12 -0
- package/lib/mjs/types/EHistory.d.ts +4 -0
- package/lib/mjs/types/EHistory.js +12 -0
- package/package.json +1 -1
- package/src/types/EHistory.ts +10 -0
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ ETSOO Extended abstract history class
|
|
|
68
68
|
|back|Back to the previous state|
|
|
69
69
|
|clear|Clear all states but keep event listeners|
|
|
70
70
|
|forward|Forward to the next state|
|
|
71
|
+
|getStatus|Get [undo, redo] status|
|
|
71
72
|
|go|Go to the specific state|
|
|
72
73
|
|pushState|Adds an entry to the history stack|
|
|
73
74
|
|replaceState|Modifies the current history entry|
|
|
@@ -56,6 +56,10 @@ export declare abstract class EHistory<T> extends EventClass<EHistoryEventType,
|
|
|
56
56
|
* Forward to the next state
|
|
57
57
|
*/
|
|
58
58
|
forward(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Get [undo, redo] status
|
|
61
|
+
*/
|
|
62
|
+
getStatus(): [boolean, boolean];
|
|
59
63
|
/**
|
|
60
64
|
* Go to the specific state
|
|
61
65
|
* @param delta A negative value moves backwards, a positive value moves forwards
|
|
@@ -70,6 +70,18 @@ class EHistory extends EventClass_1.EventClass {
|
|
|
70
70
|
forward() {
|
|
71
71
|
this.go(1);
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Get [undo, redo] status
|
|
75
|
+
*/
|
|
76
|
+
getStatus() {
|
|
77
|
+
if (this.length < 2)
|
|
78
|
+
return [false, false];
|
|
79
|
+
if (this._index <= 0)
|
|
80
|
+
return [false, true];
|
|
81
|
+
if (this._index + 1 >= this.length)
|
|
82
|
+
return [true, false];
|
|
83
|
+
return [true, true];
|
|
84
|
+
}
|
|
73
85
|
/**
|
|
74
86
|
* Go to the specific state
|
|
75
87
|
* @param delta A negative value moves backwards, a positive value moves forwards
|
|
@@ -56,6 +56,10 @@ export declare abstract class EHistory<T> extends EventClass<EHistoryEventType,
|
|
|
56
56
|
* Forward to the next state
|
|
57
57
|
*/
|
|
58
58
|
forward(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Get [undo, redo] status
|
|
61
|
+
*/
|
|
62
|
+
getStatus(): [boolean, boolean];
|
|
59
63
|
/**
|
|
60
64
|
* Go to the specific state
|
|
61
65
|
* @param delta A negative value moves backwards, a positive value moves forwards
|
|
@@ -66,6 +66,18 @@ export class EHistory extends EventClass {
|
|
|
66
66
|
forward() {
|
|
67
67
|
this.go(1);
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Get [undo, redo] status
|
|
71
|
+
*/
|
|
72
|
+
getStatus() {
|
|
73
|
+
if (this.length < 2)
|
|
74
|
+
return [false, false];
|
|
75
|
+
if (this._index <= 0)
|
|
76
|
+
return [false, true];
|
|
77
|
+
if (this._index + 1 >= this.length)
|
|
78
|
+
return [true, false];
|
|
79
|
+
return [true, true];
|
|
80
|
+
}
|
|
69
81
|
/**
|
|
70
82
|
* Go to the specific state
|
|
71
83
|
* @param delta A negative value moves backwards, a positive value moves forwards
|
package/package.json
CHANGED
package/src/types/EHistory.ts
CHANGED
|
@@ -93,6 +93,16 @@ export abstract class EHistory<T> extends EventClass<
|
|
|
93
93
|
this.go(1);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Get [undo, redo] status
|
|
98
|
+
*/
|
|
99
|
+
getStatus(): [boolean, boolean] {
|
|
100
|
+
if (this.length < 2) return [false, false];
|
|
101
|
+
if (this._index <= 0) return [false, true];
|
|
102
|
+
if (this._index + 1 >= this.length) return [true, false];
|
|
103
|
+
return [true, true];
|
|
104
|
+
}
|
|
105
|
+
|
|
96
106
|
/**
|
|
97
107
|
* Go to the specific state
|
|
98
108
|
* @param delta A negative value moves backwards, a positive value moves forwards
|