Skip to content

Commit 82526e0

Browse files
committed
askjhdfasjhgfjhsadgf
1 parent 0a2e90b commit 82526e0

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ definition([
2121

2222
// history
2323
// update documentation
24+
// project files
2425

2526
// crackers first, then kd cham
2627
// UI by definition

app/store/history.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ let future = [];
99
let timeTravelling = false;
1010

1111
export function initHistory() {
12-
1312
autorun(() => {
14-
1513
const { config, palettes, mappings, dplcs, tiles } = environment;
1614
// traverse everything we want to react to...
1715
config.dplcsEnabled;
@@ -20,10 +18,8 @@ export function initHistory() {
2018
mappings.forEach((a) => a.forEach((b) => Object.values(b)));
2119
dplcs.forEach((a) => a.forEach((b) => Object.values(b)));
2220

23-
!timeTravelling && addHistory();
24-
21+
addHistory();
2522
}, { delay: 200 });
26-
2723
}
2824

2925
function getCurrent() {
@@ -47,20 +43,23 @@ function setCurrent() {
4743
}
4844

4945
const addHistory = () => {
50-
console.log('add history');
51-
now && past.push(now);
46+
if (!timeTravelling) {
47+
console.log('add history');
48+
now && past.push(now);
5249

53-
now = getCurrent();
50+
now = getCurrent();
5451

55-
future = [];
52+
future = [];
5653

57-
if (past.length >= maxHistory) {
58-
past.shift();
54+
if (past.length >= maxHistory) {
55+
past.shift();
56+
}
5957
}
6058
};
6159

6260
export const undo = throttle(() => {
6361
timeTravelling = true;
62+
console.log(true);
6463

6564
if (past.length) {
6665
future.push(now);
@@ -70,6 +69,7 @@ export const undo = throttle(() => {
7069
setCurrent();
7170
}
7271

72+
console.log(false);
7373
timeTravelling = false;
7474
}, 100);
7575

0 commit comments

Comments
 (0)