Skip to content
Snippets Groups Projects
Commit 4fdf23b3 authored by Remi Lazarini's avatar Remi Lazarini
Browse files

[ivette] fix bufferController notify

parent 0a68dfa2
No related branches found
No related tags found
No related merge requests found
...@@ -155,6 +155,7 @@ export type BufferCallback = () => void; ...@@ -155,6 +155,7 @@ export type BufferCallback = () => void;
export class BufferController { export class BufferController {
private readonly evt = new Events(); private readonly evt = new Events();
private errors = 0; private errors = 0;
private notified = false;
/** Notify all reset listener events. */ /** Notify all reset listener events. */
reset(): void { this.evt.emit('reset'); } reset(): void { this.evt.emit('reset'); }
...@@ -168,6 +169,9 @@ export class BufferController { ...@@ -168,6 +169,9 @@ export class BufferController {
/** There are active listeners for Commit event. */ /** There are active listeners for Commit event. */
hasCommit(): boolean { return this.evt.listenerCount('commit') > 0; } hasCommit(): boolean { return this.evt.listenerCount('commit') > 0; }
/** Reset notified to false. */
resetNotified(): void { this.notified = false; }
/** Get the number of errors */ /** Get the number of errors */
getErrors(): number { return this.errors; } getErrors(): number { return this.errors; }
...@@ -178,7 +182,12 @@ export class BufferController { ...@@ -178,7 +182,12 @@ export class BufferController {
} }
/** @internal */ /** @internal */
protected notify(): void { this.evt.emit('update'); } protected notify(): void {
if(!this.notified) {
this.evt.emit('update');
this.notified = true;
}
}
/** @internal */ /** @internal */
onChange(fn: BufferCallback): void { this.evt.addListener('update', fn); } onChange(fn: BufferCallback): void { this.evt.addListener('update', fn); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment