File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export interface AppEvent<T> {
4
4
( listener : ( event : T ) => void ) : Disposable ;
5
5
}
6
6
7
- export interface AppEventEmitter < T > {
7
+ export interface AppEventEmitter < T > extends Disposable {
8
8
event : AppEvent < T > ;
9
9
fire ( data : T ) : void ;
10
10
}
Original file line number Diff line number Diff line change @@ -61,7 +61,9 @@ export class DbConfigStore extends DisposableObject {
61
61
this . configErrors = [ ] ;
62
62
this . configWatcher = undefined ;
63
63
this . configValidator = new DbConfigValidator ( app . extensionPath ) ;
64
- this . onDidChangeConfigEventEmitter = app . createEventEmitter < void > ( ) ;
64
+ this . onDidChangeConfigEventEmitter = this . push (
65
+ app . createEventEmitter < void > ( ) ,
66
+ ) ;
65
67
this . onDidChangeConfig = this . onDidChangeConfigEventEmitter . event ;
66
68
}
67
69
Original file line number Diff line number Diff line change 1
1
import { App } from "../common/app" ;
2
2
import { AppEvent , AppEventEmitter } from "../common/events" ;
3
3
import { ValueResult } from "../common/value-result" ;
4
+ import { DisposableObject } from "../pure/disposable-object" ;
4
5
import { DbConfigStore } from "./config/db-config-store" ;
5
6
import {
6
7
DbItem ,
@@ -23,7 +24,7 @@ import {
23
24
import { createRemoteTree } from "./db-tree-creator" ;
24
25
import { DbConfigValidationError } from "./db-validation-errors" ;
25
26
26
- export class DbManager {
27
+ export class DbManager extends DisposableObject {
27
28
public readonly onDbItemsChanged : AppEvent < void > ;
28
29
public static readonly DB_EXPANDED_STATE_KEY = "db_expanded" ;
29
30
private readonly onDbItemsChangesEventEmitter : AppEventEmitter < void > ;
@@ -32,7 +33,11 @@ export class DbManager {
32
33
private readonly app : App ,
33
34
private readonly dbConfigStore : DbConfigStore ,
34
35
) {
35
- this . onDbItemsChangesEventEmitter = app . createEventEmitter < void > ( ) ;
36
+ super ( ) ;
37
+
38
+ this . onDbItemsChangesEventEmitter = this . push (
39
+ app . createEventEmitter < void > ( ) ,
40
+ ) ;
36
41
this . onDbItemsChanged = this . onDbItemsChangesEventEmitter . event ;
37
42
38
43
this . dbConfigStore . onDidChangeConfig ( ( ) => {
Original file line number Diff line number Diff line change @@ -63,4 +63,8 @@ export class MockAppEventEmitter<T> implements AppEventEmitter<T> {
63
63
public fire ( ) : void {
64
64
// no-op
65
65
}
66
+
67
+ public dispose ( ) {
68
+ // no-op
69
+ }
66
70
}
You can’t perform that action at this time.
0 commit comments