Only expose event to subclasses, instead of event emitter
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { Discovery } from "../discovery";
|
import { Discovery } from "../discovery";
|
||||||
import {
|
import {
|
||||||
|
Event,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
RelativePattern,
|
RelativePattern,
|
||||||
Uri,
|
Uri,
|
||||||
@@ -36,7 +37,7 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
|
|||||||
private pathData: T[] = [];
|
private pathData: T[] = [];
|
||||||
|
|
||||||
/** Event that fires whenever the contents of `pathData` changes */
|
/** Event that fires whenever the contents of `pathData` changes */
|
||||||
protected readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
|
private readonly onDidChangePathDataEmitter: AppEventEmitter<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of file paths that may have changed on disk since the last time
|
* The set of file paths that may have changed on disk since the last time
|
||||||
@@ -75,6 +76,10 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
|
|||||||
return this.pathData;
|
return this.pathData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected get onDidChangePathData(): Event<void> {
|
||||||
|
return this.onDidChangePathDataEmitter.event;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute any extra data to be stored regarding the given path.
|
* Compute any extra data to be stored regarding the given path.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export class QueryDiscovery
|
|||||||
* Event that fires when the set of queries in the workspace changes.
|
* Event that fires when the set of queries in the workspace changes.
|
||||||
*/
|
*/
|
||||||
public get onDidChangeQueries(): Event<void> {
|
public get onDidChangeQueries(): Event<void> {
|
||||||
return this.onDidChangePathDataEmitter.event;
|
return this.onDidChangePathData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export class QueryPackDiscovery extends FilePathDiscovery<QueryPack> {
|
|||||||
* Event that fires when the set of query packs in the workspace changes.
|
* Event that fires when the set of query packs in the workspace changes.
|
||||||
*/
|
*/
|
||||||
public get onDidChangeQueryPacks(): Event<void> {
|
public get onDidChangeQueryPacks(): Event<void> {
|
||||||
return this.onDidChangePathDataEmitter.event;
|
return this.onDidChangePathData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class TestFilePathDiscovery extends FilePathDiscovery<TestData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get onDidChangePaths() {
|
public get onDidChangePaths() {
|
||||||
return this.onDidChangePathDataEmitter.event;
|
return this.onDidChangePathData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPathData(): readonly TestData[] {
|
public getPathData(): readonly TestData[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user