Skip to content

Commit 590ed53

Browse files
Add a basic collection of env watchers.
1 parent d3f55b6 commit 590ed53

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
import { Event } from 'vscode';
5+
import { IPythonEnvsWatcher, PythonEnvsChangedEvent, PythonEnvsWatcher } from './watcher';
6+
7+
/**
8+
* A wrapper around a set of watchers.
9+
*
10+
* If any of the wrapped watchers emits an event then this wrapper
11+
* emits that event.
12+
*/
13+
export class PythonEnvsWatchers {
14+
public readonly onChanged: Event<PythonEnvsChangedEvent>;
15+
private watcher = new PythonEnvsWatcher();
16+
17+
constructor(watchers: ReadonlyArray<IPythonEnvsWatcher>) {
18+
this.onChanged = this.watcher.onChanged;
19+
watchers.forEach((w) => {
20+
w.onChanged((e) => this.watcher.fire(e));
21+
});
22+
}
23+
}

0 commit comments

Comments
 (0)