Add remove event listener methods
This commit is contained in:
parent
d4b68154df
commit
91675ea99c
6 changed files with 54 additions and 0 deletions
|
|
@ -9,6 +9,15 @@ export class FileChangeNotifier {
|
|||
this.listeners.push(listener);
|
||||
}
|
||||
|
||||
public removeFileChangeListener(
|
||||
listener: (filePath: RelativePath) => unknown
|
||||
): void {
|
||||
const index = this.listeners.indexOf(listener);
|
||||
if (index !== -1) {
|
||||
this.listeners.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public notifyOfFileChange(filePath: RelativePath): void {
|
||||
this.listeners.forEach((listener) => listener(filePath));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,15 @@ export class Syncer {
|
|||
this.remainingOperationsListeners.push(listener);
|
||||
}
|
||||
|
||||
public removeRemainingOperationsListener(
|
||||
listener: (remainingOperations: number) => unknown
|
||||
): void {
|
||||
const index = this.remainingOperationsListeners.indexOf(listener);
|
||||
if (index !== -1) {
|
||||
this.remainingOperationsListeners.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public async syncLocallyCreatedFile(
|
||||
relativePath: RelativePath
|
||||
): Promise<void> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue