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
@@ -27,7 +27,7 @@ export class CanvasRenderer extends Disposable implements IRenderer {
public dimensions: IRenderDimensions;
private _onRequestRedraw = new EventEmitter<IRequestRedrawEvent>();
private readonly _onRequestRedraw = new EventEmitter<IRequestRedrawEvent>();
public readonly onRequestRedraw = this._onRequestRedraw.event;
constructor(
+2 -2
View File
@@ -15,9 +15,9 @@ export class WebglAddon implements ITerminalAddon {
private _terminal?: Terminal;
private _renderer?: WebglRenderer;
private _onChangeTextureAtlas = new EventEmitter<HTMLElement>();
private readonly _onChangeTextureAtlas = new EventEmitter<HTMLElement>();
public readonly onChangeTextureAtlas = this._onChangeTextureAtlas.event;
private _onContextLoss = new EventEmitter<void>();
private readonly _onContextLoss = new EventEmitter<void>();
public readonly onContextLoss = this._onContextLoss.event;
constructor(
@@ -55,11 +55,11 @@ export class WebglRenderer extends Disposable implements IRenderer {
private _isAttached: boolean;
private _contextRestorationTimeout: number | undefined;
private _onChangeTextureAtlas = new EventEmitter<HTMLCanvasElement>();
private readonly _onChangeTextureAtlas = new EventEmitter<HTMLCanvasElement>();
public readonly onChangeTextureAtlas = this._onChangeTextureAtlas.event;
private _onRequestRedraw = new EventEmitter<IRequestRedrawEvent>();
private readonly _onRequestRedraw = new EventEmitter<IRequestRedrawEvent>();
public readonly onRequestRedraw = this._onRequestRedraw.event;
private _onContextLoss = new EventEmitter<void>();
private readonly _onContextLoss = new EventEmitter<void>();
public readonly onContextLoss = this._onContextLoss.event;
constructor(
+2 -2
View File
@@ -26,9 +26,9 @@ export class Linkifier2 extends Disposable implements ILinkifier2 {
private _activeProviderReplies: Map<Number, ILinkWithState[] | undefined> | undefined;
private _activeLine: number = -1;
private _onShowLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
private readonly _onShowLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
public readonly onShowLinkUnderline = this._onShowLinkUnderline.event;
private _onHideLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
private readonly _onHideLinkUnderline = this.register(new EventEmitter<ILinkifierEvent>());
public readonly onHideLinkUnderline = this._onHideLinkUnderline.event;
constructor(
+10 -10
View File
@@ -122,26 +122,26 @@ export class Terminal extends CoreTerminal implements ITerminal {
private _colorManager: ColorManager | undefined;
private _theme: ITheme | undefined;
private _onCursorMove = new EventEmitter<void>();
private readonly _onCursorMove = new EventEmitter<void>();
public readonly onCursorMove = this._onCursorMove.event;
private _onKey = new EventEmitter<{ key: string, domEvent: KeyboardEvent }>();
private readonly _onKey = new EventEmitter<{ key: string, domEvent: KeyboardEvent }>();
public readonly onKey = this._onKey.event;
private _onRender = new EventEmitter<{ start: number, end: number }>();
private readonly _onRender = new EventEmitter<{ start: number, end: number }>();
public readonly onRender = this._onRender.event;
private _onSelectionChange = new EventEmitter<void>();
private readonly _onSelectionChange = new EventEmitter<void>();
public readonly onSelectionChange = this._onSelectionChange.event;
private _onTitleChange = new EventEmitter<string>();
private readonly _onTitleChange = new EventEmitter<string>();
public readonly onTitleChange = this._onTitleChange.event;
private _onBell = new EventEmitter<void>();
private readonly _onBell = new EventEmitter<void>();
public readonly onBell = this._onBell.event;
private _onFocus = new EventEmitter<void>();
private readonly _onFocus = new EventEmitter<void>();
public readonly onFocus = this._onFocus.event;
private _onBlur = new EventEmitter<void>();
private readonly _onBlur = new EventEmitter<void>();
public readonly onBlur = this._onBlur.event;
private _onA11yCharEmitter = new EventEmitter<string>();
private readonly _onA11yCharEmitter = new EventEmitter<string>();
public readonly onA11yChar = this._onA11yCharEmitter.event;
private _onA11yTabEmitter = new EventEmitter<number>();
private readonly _onA11yTabEmitter = new EventEmitter<number>();
public readonly onA11yTab = this._onA11yTabEmitter.event;
/**
+1 -1
View File
@@ -16,7 +16,7 @@ export class CharSizeService implements ICharSizeService {
public get hasValidSize(): boolean { return this.width > 0 && this.height > 0; }
private _onCharSizeChange = new EventEmitter<void>();
private readonly _onCharSizeChange = new EventEmitter<void>();
public readonly onCharSizeChange = this._onCharSizeChange.event;
constructor(
+4 -4
View File
@@ -39,13 +39,13 @@ export class RenderService extends Disposable implements IRenderService {
columnSelectMode: false
};
private _onDimensionsChange = new EventEmitter<IRenderDimensions>();
private readonly _onDimensionsChange = new EventEmitter<IRenderDimensions>();
public readonly onDimensionsChange = this._onDimensionsChange.event;
private _onRenderedViewportChange = new EventEmitter<{ start: number, end: number }>();
private readonly _onRenderedViewportChange = new EventEmitter<{ start: number, end: number }>();
public readonly onRenderedViewportChange = this._onRenderedViewportChange.event;
private _onRender = new EventEmitter<{ start: number, end: number }>();
private readonly _onRender = new EventEmitter<{ start: number, end: number }>();
public readonly onRender = this._onRender.event;
private _onRefreshRequest = new EventEmitter<{ start: number, end: number }>();
private readonly _onRefreshRequest = new EventEmitter<{ start: number, end: number }>();
public readonly onRefreshRequest = this._onRefreshRequest.event;
public get dimensions(): IRenderDimensions { return this._renderer.dimensions; }
+4 -4
View File
@@ -111,13 +111,13 @@ export class SelectionService extends Disposable implements ISelectionService {
private _oldSelectionStart: [number, number] | undefined = undefined;
private _oldSelectionEnd: [number, number] | undefined = undefined;
private _onLinuxMouseSelection = this.register(new EventEmitter<string>());
private readonly _onLinuxMouseSelection = this.register(new EventEmitter<string>());
public readonly onLinuxMouseSelection = this._onLinuxMouseSelection.event;
private _onRedrawRequest = this.register(new EventEmitter<ISelectionRedrawRequestEvent>());
private readonly _onRedrawRequest = this.register(new EventEmitter<ISelectionRedrawRequestEvent>());
public readonly onRequestRedraw = this._onRedrawRequest.event;
private _onSelectionChange = this.register(new EventEmitter<void>());
private readonly _onSelectionChange = this.register(new EventEmitter<void>());
public readonly onSelectionChange = this._onSelectionChange.event;
private _onRequestScrollLines = this.register(new EventEmitter<ISelectionRequestScrollLinesEvent>());
private readonly _onRequestScrollLines = this.register(new EventEmitter<ISelectionRequestScrollLinesEvent>());
public readonly onRequestScrollLines = this._onRequestScrollLines.event;
constructor(
+3 -3
View File
@@ -25,11 +25,11 @@ export class CircularList<T> implements ICircularList<T> {
private _startIndex: number;
private _length: number;
public onDeleteEmitter = new EventEmitter<IDeleteEvent>();
public readonly onDeleteEmitter = new EventEmitter<IDeleteEvent>();
public readonly onDelete = this.onDeleteEmitter.event;
public onInsertEmitter = new EventEmitter<IInsertEvent>();
public readonly onInsertEmitter = new EventEmitter<IInsertEvent>();
public readonly onInsert = this.onInsertEmitter.event;
public onTrimEmitter = new EventEmitter<number>();
public readonly onTrimEmitter = new EventEmitter<number>();
public readonly onTrim = this.onTrimEmitter.event;
constructor(
+4 -4
View File
@@ -61,15 +61,15 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal {
private _writeBuffer: WriteBuffer;
private _windowsMode: IDisposable | undefined;
private _onBinary = new EventEmitter<string>();
private readonly _onBinary = new EventEmitter<string>();
public readonly onBinary = this._onBinary.event;
private _onData = new EventEmitter<string>();
private readonly _onData = new EventEmitter<string>();
public readonly onData = this._onData.event;
protected _onLineFeed = new EventEmitter<void>();
public readonly onLineFeed = this._onLineFeed.event;
private _onResize = new EventEmitter<{ cols: number, rows: number }>();
private readonly _onResize = new EventEmitter<{ cols: number, rows: number }>();
public readonly onResize = this._onResize.event;
protected _onWriteParsed = new EventEmitter<void>();
protected readonly _onWriteParsed = new EventEmitter<void>();
public readonly onWriteParsed = this._onWriteParsed.event;
/**
+13 -13
View File
@@ -129,32 +129,32 @@ export class InputHandler extends Disposable implements IInputHandler {
private _activeBuffer: IBuffer;
private _onRequestBell = new EventEmitter<void>();
private readonly _onRequestBell = new EventEmitter<void>();
public readonly onRequestBell = this._onRequestBell.event;
private _onRequestRefreshRows = new EventEmitter<number, number>();
private readonly _onRequestRefreshRows = new EventEmitter<number, number>();
public readonly onRequestRefreshRows = this._onRequestRefreshRows.event;
private _onRequestReset = new EventEmitter<void>();
private readonly _onRequestReset = new EventEmitter<void>();
public readonly onRequestReset = this._onRequestReset.event;
private _onRequestSendFocus = new EventEmitter<void>();
private readonly _onRequestSendFocus = new EventEmitter<void>();
public readonly onRequestSendFocus = this._onRequestSendFocus.event;
private _onRequestSyncScrollBar = new EventEmitter<void>();
private readonly _onRequestSyncScrollBar = new EventEmitter<void>();
public readonly onRequestSyncScrollBar = this._onRequestSyncScrollBar.event;
private _onRequestWindowsOptionsReport = new EventEmitter<WindowsOptionsReportType>();
private readonly _onRequestWindowsOptionsReport = new EventEmitter<WindowsOptionsReportType>();
public readonly onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event;
private _onA11yChar = new EventEmitter<string>();
private readonly _onA11yChar = new EventEmitter<string>();
public readonly onA11yChar = this._onA11yChar.event;
private _onA11yTab = new EventEmitter<number>();
private readonly _onA11yTab = new EventEmitter<number>();
public readonly onA11yTab = this._onA11yTab.event;
private _onCursorMove = new EventEmitter<void>();
private readonly _onCursorMove = new EventEmitter<void>();
public readonly onCursorMove = this._onCursorMove.event;
private _onLineFeed = new EventEmitter<void>();
private readonly _onLineFeed = new EventEmitter<void>();
public readonly onLineFeed = this._onLineFeed.event;
private _onScroll = new EventEmitter<number>();
private readonly _onScroll = new EventEmitter<number>();
public readonly onScroll = this._onScroll.event;
private _onTitleChange = new EventEmitter<string>();
private readonly _onTitleChange = new EventEmitter<string>();
public readonly onTitleChange = this._onTitleChange.event;
private _onColor = new EventEmitter<IColorEvent>();
private readonly _onColor = new EventEmitter<IColorEvent>();
public readonly onColor = this._onColor.event;
private _parseStack: IParseStack = {
+1 -1
View File
@@ -19,7 +19,7 @@ export class BufferSet extends Disposable implements IBufferSet {
private _alt!: Buffer;
private _activeBuffer!: Buffer;
private _onBufferActivate = this.register(new EventEmitter<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}>());
private readonly _onBufferActivate = this.register(new EventEmitter<{activeBuffer: IBuffer, inactiveBuffer: IBuffer}>());
public readonly onBufferActivate = this._onBufferActivate.event;
/**
+1 -1
View File
@@ -15,7 +15,7 @@ export class Marker extends Disposable implements IMarker {
public get id(): number { return this._id; }
private _onDispose = new EventEmitter<void>();
private readonly _onDispose = new EventEmitter<void>();
public readonly onDispose = this._onDispose.event;
constructor(
+1 -1
View File
@@ -42,7 +42,7 @@ export class WriteBuffer {
private _syncCalls = 0;
private _didUserInput = false;
private _onWriteParsed = new EventEmitter<void>();
private readonly _onWriteParsed = new EventEmitter<void>();
public readonly onWriteParsed = this._onWriteParsed.event;
constructor(private _action: (data: string | Uint8Array, promiseResult?: boolean) => void | Promise<boolean>) { }
+1 -1
View File
@@ -12,7 +12,7 @@ export class BufferNamespaceApi implements IBufferNamespaceApi {
private _normal: BufferApiView;
private _alternate: BufferApiView;
private _onBufferChange = new EventEmitter<IBufferApi>();
private readonly _onBufferChange = new EventEmitter<IBufferApi>();
public readonly onBufferChange = this._onBufferChange.event;
constructor(private _core: ICoreTerminal) {
+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>) {

Some files were not shown because too many files have changed in this diff Show More