Skip to content

Commit 462bc61

Browse files
authored
Merge pull request #38 from edgardmessias/fixed_debounce
Fixed debounce calling
2 parents 82adb57 + 1053ffc commit 462bc61

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/repository.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
Event
1212
} from "vscode";
1313
import { Resource } from "./resource";
14-
import { throttleAsync } from "./decorators";
14+
import { throttleAsync, debounce } from "./decorators";
1515
import { Repository as BaseRepository } from "./svn";
1616
import { SvnStatusBar } from "./statusBar";
1717
import { dispose } from "./util";
@@ -80,17 +80,16 @@ export class Repository {
8080
}
8181

8282
private addEventListeners() {
83-
// this.watcher.onDidChange(throttleAsync(this.update, "update", this));
84-
// this.watcher.onDidCreate(throttleAsync(this.update, "update", this));
85-
// this.watcher.onDidDelete(throttleAsync(this.update, "update", this));
83+
const debounceUpdate = debounce(this.update, 1000, this);
84+
8685
this.watcher.onDidChange(() => {
87-
this.update();
86+
debounceUpdate();
8887
});
8988
this.watcher.onDidCreate(() => {
90-
this.update();
89+
debounceUpdate();
9190
});
9291
this.watcher.onDidDelete(() => {
93-
this.update();
92+
debounceUpdate();
9493
});
9594
}
9695

0 commit comments

Comments
 (0)