Skip to content

Commit f4edc6e

Browse files
Merge pull request #3345 from github/robertbrignull/addWatcher-unknown
Use bind instead of thisArg parameter in MultiFileSystemWatcher
2 parents 6472ea8 + 8a389f2 commit f4edc6e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

extensions/ql-vscode/src/common/vscode/multi-file-system-watcher.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ class WatcherCollection extends DisposableObject {
1818
* deleted.
1919
* @param thisArgs The `this` argument for the event listener.
2020
*/
21-
public addWatcher(
22-
pattern: GlobPattern,
23-
listener: (e: Uri) => any,
24-
thisArgs: any,
25-
): void {
21+
public addWatcher(pattern: GlobPattern, listener: (e: Uri) => void): void {
2622
const watcher = workspace.createFileSystemWatcher(pattern);
27-
this.push(watcher.onDidCreate(listener, thisArgs));
28-
this.push(watcher.onDidChange(listener, thisArgs));
29-
this.push(watcher.onDidDelete(listener, thisArgs));
23+
this.push(watcher.onDidCreate(listener));
24+
this.push(watcher.onDidChange(listener));
25+
this.push(watcher.onDidDelete(listener));
3026
}
3127
}
3228

@@ -54,7 +50,7 @@ export class MultiFileSystemWatcher extends DisposableObject {
5450
* @param pattern The pattern to watch.
5551
*/
5652
public addWatch(pattern: GlobPattern): void {
57-
this.watchers.addWatcher(pattern, this.handleDidChange, this);
53+
this.watchers.addWatcher(pattern, this.handleDidChange.bind(this));
5854
}
5955

6056
/**

0 commit comments

Comments
 (0)