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> {
44 ( listener : ( event : T ) => void ) : Disposable ;
55}
66
7- export interface AppEventEmitter < T > {
7+ export interface AppEventEmitter < T > extends Disposable {
88 event : AppEvent < T > ;
99 fire ( data : T ) : void ;
1010}
Original file line number Diff line number Diff line change @@ -61,7 +61,9 @@ export class DbConfigStore extends DisposableObject {
6161 this . configErrors = [ ] ;
6262 this . configWatcher = undefined ;
6363 this . configValidator = new DbConfigValidator ( app . extensionPath ) ;
64- this . onDidChangeConfigEventEmitter = app . createEventEmitter < void > ( ) ;
64+ this . onDidChangeConfigEventEmitter = this . push (
65+ app . createEventEmitter < void > ( ) ,
66+ ) ;
6567 this . onDidChangeConfig = this . onDidChangeConfigEventEmitter . event ;
6668 }
6769
Original file line number Diff line number Diff line change 11import { App } from "../common/app" ;
22import { AppEvent , AppEventEmitter } from "../common/events" ;
33import { ValueResult } from "../common/value-result" ;
4+ import { DisposableObject } from "../pure/disposable-object" ;
45import { DbConfigStore } from "./config/db-config-store" ;
56import {
67 DbItem ,
@@ -23,7 +24,7 @@ import {
2324import { createRemoteTree } from "./db-tree-creator" ;
2425import { DbConfigValidationError } from "./db-validation-errors" ;
2526
26- export class DbManager {
27+ export class DbManager extends DisposableObject {
2728 public readonly onDbItemsChanged : AppEvent < void > ;
2829 public static readonly DB_EXPANDED_STATE_KEY = "db_expanded" ;
2930 private readonly onDbItemsChangesEventEmitter : AppEventEmitter < void > ;
@@ -32,7 +33,11 @@ export class DbManager {
3233 private readonly app : App ,
3334 private readonly dbConfigStore : DbConfigStore ,
3435 ) {
35- this . onDbItemsChangesEventEmitter = app . createEventEmitter < void > ( ) ;
36+ super ( ) ;
37+
38+ this . onDbItemsChangesEventEmitter = this . push (
39+ app . createEventEmitter < void > ( ) ,
40+ ) ;
3641 this . onDbItemsChanged = this . onDbItemsChangesEventEmitter . event ;
3742
3843 this . dbConfigStore . onDidChangeConfig ( ( ) => {
Original file line number Diff line number Diff line change @@ -63,4 +63,8 @@ export class MockAppEventEmitter<T> implements AppEventEmitter<T> {
6363 public fire ( ) : void {
6464 // no-op
6565 }
66+
67+ public dispose ( ) {
68+ // no-op
69+ }
6670}
You can’t perform that action at this time.
0 commit comments