Make all emitters readonly

This commit is contained in:
Daniel Imms
2022-10-01 08:02:32 -07:00
parent cf9949840b
commit 1a22c44f2b
22 changed files with 67 additions and 67 deletions
+3 -3
View File
@@ -6,7 +6,7 @@
import { IBufferService, IOptionsService } from 'common/services/Services';
import { BufferSet } from 'common/buffer/BufferSet';
import { IBufferSet, IBuffer } from 'common/buffer/Types';
import { EventEmitter, IEvent } from 'common/EventEmitter';
import { EventEmitter, IEventEmitter, IEvent } from 'common/EventEmitter';
import { Disposable } from 'common/Lifecycle';
import { IAttributeData, IBufferLine, ScrollSource } from 'common/Types';
@@ -22,9 +22,9 @@ export class BufferService extends Disposable implements IBufferService {
/** Whether the user is scrolling (locks the scroll position) */
public isUserScrolling: boolean = false;
private _onResize = new EventEmitter<{ cols: number, rows: number }>();
private readonly _onResize = new EventEmitter<{ cols: number, rows: number }>();
public readonly onResize = this._onResize.event;
private _onScroll = new EventEmitter<number>();
private readonly _onScroll = new EventEmitter<number>();
public readonly onScroll = this._onScroll.event;
public get buffer(): IBuffer { return this.buffers.active; }
+1 -1
View File
@@ -172,7 +172,7 @@ export class CoreMouseService implements ICoreMouseService {
private _activeEncoding: string = '';
private _lastEvent: ICoreMouseEvent | null = null;
private _onProtocolChange = new EventEmitter<CoreMouseEventType>();
private readonly _onProtocolChange = new EventEmitter<CoreMouseEventType>();
public readonly onProtocolChange = this._onProtocolChange.event;
constructor(
+3 -3
View File
@@ -34,11 +34,11 @@ export class CoreService extends Disposable implements ICoreService {
// Circular dependency, this must be unset or memory will leak after Terminal.dispose
private _scrollToBottom: (() => void) | undefined;
private _onData = this.register(new EventEmitter<string>());
private readonly _onData = this.register(new EventEmitter<string>());
public readonly onData = this._onData.event;
private _onUserInput = this.register(new EventEmitter<void>());
private readonly _onUserInput = this.register(new EventEmitter<void>());
public readonly onUserInput = this._onUserInput.event;
private _onBinary = this.register(new EventEmitter<string>());
private readonly _onBinary = this.register(new EventEmitter<string>());
public readonly onBinary = this._onBinary.event;
constructor(
+2 -2
View File
@@ -27,9 +27,9 @@ export class DecorationService extends Disposable implements IDecorationService
*/
private readonly _decorations: SortedList<IInternalDecoration> = new SortedList(e => e?.marker.line);
private _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());
private readonly _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());
public readonly onDecorationRegistered = this._onDecorationRegistered.event;
private _onDecorationRemoved = this.register(new EventEmitter<IInternalDecoration>());
private readonly _onDecorationRemoved = this.register(new EventEmitter<IInternalDecoration>());
public readonly onDecorationRemoved = this._onDecorationRemoved.event;
public get decorations(): IterableIterator<IInternalDecoration> { return this._decorations.values(); }
+1 -1
View File
@@ -57,7 +57,7 @@ export class OptionsService implements IOptionsService {
public readonly rawOptions: Required<ITerminalOptions>;
public options: Required<ITerminalOptions>;
private _onOptionChange = new EventEmitter<string>();
private readonly _onOptionChange = new EventEmitter<string>();
public readonly onOptionChange = this._onOptionChange.event;
constructor(options: Partial<ITerminalOptions>) {
+1 -1
View File
@@ -14,7 +14,7 @@ export class UnicodeService implements IUnicodeService {
private _active: string = '';
private _activeProvider: IUnicodeVersionProvider;
private _onChange = new EventEmitter<string>();
private readonly _onChange = new EventEmitter<string>();
public readonly onChange = this._onChange.event;
constructor() {