Skip to content

Commit adcf6b2

Browse files
committed
Mark public event properties readonly
1 parent 585cda3 commit adcf6b2

25 files changed

Lines changed: 62 additions & 62 deletions

File tree

src/vs/base/browser/browser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class WindowManager {
1717
private _lastZoomLevelChangeTime: number = 0;
1818
private _onDidChangeZoomLevel: Emitter<number> = new Emitter<number>();
1919

20-
public onDidChangeZoomLevel: Event<number> = this._onDidChangeZoomLevel.event;
20+
public readonly onDidChangeZoomLevel: Event<number> = this._onDidChangeZoomLevel.event;
2121
public getZoomLevel(): number {
2222
return this._zoomLevel;
2323
}
@@ -63,7 +63,7 @@ class WindowManager {
6363
private _fullscreen: boolean;
6464
private _onDidChangeFullscreen: Emitter<void> = new Emitter<void>();
6565

66-
public onDidChangeFullscreen: Event<void> = this._onDidChangeFullscreen.event;
66+
public readonly onDidChangeFullscreen: Event<void> = this._onDidChangeFullscreen.event;
6767
public setFullscreen(fullscreen: boolean): void {
6868
if (this._fullscreen === fullscreen) {
6969
return;
@@ -80,7 +80,7 @@ class WindowManager {
8080
private _accessibilitySupport = Platform.AccessibilitySupport.Unknown;
8181
private _onDidChangeAccessibilitySupport: Emitter<void> = new Emitter<void>();
8282

83-
public onDidChangeAccessibilitySupport: Event<void> = this._onDidChangeAccessibilitySupport.event;
83+
public readonly onDidChangeAccessibilitySupport: Event<void> = this._onDidChangeAccessibilitySupport.event;
8484
public setAccessibilitySupport(accessibilitySupport: Platform.AccessibilitySupport): void {
8585
if (this._accessibilitySupport === accessibilitySupport) {
8686
return;

src/vs/base/browser/ui/findinput/findInput.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ export class FindInput extends Widget {
6464
public domNode: HTMLElement;
6565
public inputBox: InputBox;
6666

67-
private _onDidOptionChange = this._register(new Emitter<boolean>());
68-
public onDidOptionChange: Event<boolean /* via keyboard */> = this._onDidOptionChange.event;
67+
private readonly _onDidOptionChange = this._register(new Emitter<boolean>());
68+
public readonly onDidOptionChange: Event<boolean /* via keyboard */> = this._onDidOptionChange.event;
6969

70-
private _onKeyDown = this._register(new Emitter<IKeyboardEvent>());
71-
public onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
70+
private readonly _onKeyDown = this._register(new Emitter<IKeyboardEvent>());
71+
public readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
7272

73-
private _onMouseDown = this._register(new Emitter<IMouseEvent>());
74-
public onMouseDown: Event<IMouseEvent> = this._onMouseDown.event;
73+
private readonly _onMouseDown = this._register(new Emitter<IMouseEvent>());
74+
public readonly onMouseDown: Event<IMouseEvent> = this._onMouseDown.event;
7575

76-
private _onInput = this._register(new Emitter<void>());
77-
public onInput: Event<void> = this._onInput.event;
76+
private readonly _onInput = this._register(new Emitter<void>());
77+
public readonly onInput: Event<void> = this._onInput.event;
7878

79-
private _onKeyUp = this._register(new Emitter<IKeyboardEvent>());
80-
public onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;
79+
private readonly _onKeyUp = this._register(new Emitter<IKeyboardEvent>());
80+
public readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;
8181

8282
private _onCaseSensitiveKeyDown = this._register(new Emitter<IKeyboardEvent>());
83-
public onCaseSensitiveKeyDown: Event<IKeyboardEvent> = this._onCaseSensitiveKeyDown.event;
83+
public readonly onCaseSensitiveKeyDown: Event<IKeyboardEvent> = this._onCaseSensitiveKeyDown.event;
8484

8585
constructor(parent: HTMLElement, contextViewProvider: IContextViewProvider, options?: IFindInputOptions) {
8686
super();

src/vs/base/browser/ui/inputbox/inputBox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ export class InputBox extends Widget {
104104
private inputValidationErrorBackground: Color;
105105

106106
private _onDidChange = this._register(new Emitter<string>());
107-
public onDidChange: Event<string> = this._onDidChange.event;
107+
public readonly onDidChange: Event<string> = this._onDidChange.event;
108108

109109
private _onDidHeightChange = this._register(new Emitter<number>());
110-
public onDidHeightChange: Event<number> = this._onDidHeightChange.event;
110+
public readonly onDidHeightChange: Event<number> = this._onDidHeightChange.event;
111111

112112
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider, options?: IInputOptions) {
113113
super();

src/vs/base/browser/ui/scrollbar/scrollableElement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export abstract class AbstractScrollableElement extends Widget {
164164
private _shouldRender: boolean;
165165

166166
private readonly _onScroll = this._register(new Emitter<ScrollEvent>());
167-
public onScroll: Event<ScrollEvent> = this._onScroll.event;
167+
public readonly onScroll: Event<ScrollEvent> = this._onScroll.event;
168168

169169
protected constructor(element: HTMLElement, options: ScrollableElementCreationOptions, scrollable?: Scrollable) {
170170
super();

src/vs/base/common/scrollable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class Scrollable extends Disposable {
186186
private _smoothScrolling: SmoothScrollingOperation;
187187

188188
private _onScroll = this._register(new Emitter<ScrollEvent>());
189-
public onScroll: Event<ScrollEvent> = this._onScroll.event;
189+
public readonly onScroll: Event<ScrollEvent> = this._onScroll.event;
190190

191191
constructor(smoothScrollDuration: number, scheduleAtNextAnimationFrame: (callback: () => void) => IDisposable) {
192192
super();

src/vs/editor/browser/config/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class CSSBasedConfiguration extends Disposable {
102102
private _evictUntrustedReadingsTimeout: number;
103103

104104
private _onDidChange = this._register(new Emitter<void>());
105-
public onDidChange: Event<void> = this._onDidChange.event;
105+
public readonly onDidChange: Event<void> = this._onDidChange.event;
106106

107107
constructor() {
108108
super();

src/vs/editor/browser/controller/textAreaInput.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,37 +53,37 @@ export interface ITextAreaInputHost {
5353
export class TextAreaInput extends Disposable {
5454

5555
private _onFocus = this._register(new Emitter<void>());
56-
public onFocus: Event<void> = this._onFocus.event;
56+
public readonly onFocus: Event<void> = this._onFocus.event;
5757

5858
private _onBlur = this._register(new Emitter<void>());
59-
public onBlur: Event<void> = this._onBlur.event;
59+
public readonly onBlur: Event<void> = this._onBlur.event;
6060

6161
private _onKeyDown = this._register(new Emitter<IKeyboardEvent>());
62-
public onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
62+
public readonly onKeyDown: Event<IKeyboardEvent> = this._onKeyDown.event;
6363

6464
private _onKeyUp = this._register(new Emitter<IKeyboardEvent>());
65-
public onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;
65+
public readonly onKeyUp: Event<IKeyboardEvent> = this._onKeyUp.event;
6666

6767
private _onCut = this._register(new Emitter<void>());
68-
public onCut: Event<void> = this._onCut.event;
68+
public readonly onCut: Event<void> = this._onCut.event;
6969

7070
private _onPaste = this._register(new Emitter<IPasteData>());
71-
public onPaste: Event<IPasteData> = this._onPaste.event;
71+
public readonly onPaste: Event<IPasteData> = this._onPaste.event;
7272

7373
private _onType = this._register(new Emitter<ITypeData>());
74-
public onType: Event<ITypeData> = this._onType.event;
74+
public readonly onType: Event<ITypeData> = this._onType.event;
7575

7676
private _onCompositionStart = this._register(new Emitter<void>());
77-
public onCompositionStart: Event<void> = this._onCompositionStart.event;
77+
public readonly onCompositionStart: Event<void> = this._onCompositionStart.event;
7878

7979
private _onCompositionUpdate = this._register(new Emitter<ICompositionData>());
80-
public onCompositionUpdate: Event<ICompositionData> = this._onCompositionUpdate.event;
80+
public readonly onCompositionUpdate: Event<ICompositionData> = this._onCompositionUpdate.event;
8181

8282
private _onCompositionEnd = this._register(new Emitter<void>());
83-
public onCompositionEnd: Event<void> = this._onCompositionEnd.event;
83+
public readonly onCompositionEnd: Event<void> = this._onCompositionEnd.event;
8484

8585
private _onSelectionChangeRequest = this._register(new Emitter<Selection>());
86-
public onSelectionChangeRequest: Event<Selection> = this._onSelectionChangeRequest.event;
86+
public readonly onSelectionChangeRequest: Event<Selection> = this._onSelectionChangeRequest.event;
8787

8888
// ---
8989

src/vs/editor/browser/widget/codeEditorWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ class CodeEditorWidgetFocusTracker extends Disposable {
456456
private _domFocusTracker: dom.IFocusTracker;
457457

458458
private _onChange: Emitter<void> = this._register(new Emitter<void>());
459-
public onChange: Event<void> = this._onChange.event;
459+
public readonly onChange: Event<void> = this._onChange.event;
460460

461461
constructor(domElement: HTMLElement) {
462462
super();

src/vs/editor/common/config/commonEditorConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const TabFocus: ITabFocus = new class implements ITabFocus {
3535
private _tabFocus: boolean = false;
3636

3737
private _onDidChangeTabFocus: Emitter<boolean> = new Emitter<boolean>();
38-
public onDidChangeTabFocus: Event<boolean> = this._onDidChangeTabFocus.event;
38+
public readonly onDidChangeTabFocus: Event<boolean> = this._onDidChangeTabFocus.event;
3939

4040
public getTabFocusMode(): boolean {
4141
return this._tabFocus;
@@ -70,7 +70,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
7070
private _lineNumbersDigitCount: number;
7171

7272
private _onDidChange = this._register(new Emitter<editorOptions.IConfigurationChangedEvent>());
73-
public onDidChange: Event<editorOptions.IConfigurationChangedEvent> = this._onDidChange.event;
73+
public readonly onDidChange: Event<editorOptions.IConfigurationChangedEvent> = this._onDidChange.event;
7474

7575
constructor(options: editorOptions.IEditorOptions) {
7676
super();

src/vs/editor/common/config/editorZoom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const EditorZoom: IEditorZoom = new class implements IEditorZoom {
1717
private _zoomLevel: number = 0;
1818

1919
private _onDidChangeZoomLevel: Emitter<number> = new Emitter<number>();
20-
public onDidChangeZoomLevel: Event<number> = this._onDidChangeZoomLevel.event;
20+
public readonly onDidChangeZoomLevel: Event<number> = this._onDidChangeZoomLevel.event;
2121

2222
public getZoomLevel(): number {
2323
return this._zoomLevel;

0 commit comments

Comments
 (0)