Remove IEvent and runAndSubscribe

This commit is contained in:
Daniel Imms
2024-07-14 08:17:16 -07:00
parent 9141b525a6
commit 9c7e2ea98e
15 changed files with 126 additions and 141 deletions
+10 -11
View File
@@ -5,7 +5,6 @@
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, ICoreMouseService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService } from 'common/services/Services';
import { UnicodeService } from 'common/services/UnicodeService';
import { IEvent } from 'common/EventEmitter';
import { clone } from 'common/Clone';
import { DEFAULT_OPTIONS } from 'common/services/OptionsService';
import { IBufferSet, IBuffer } from 'common/buffer/Types';
@@ -13,14 +12,14 @@ import { BufferSet } from 'common/buffer/BufferSet';
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEventType, ICharset, IModes, IAttributeData, IOscLinkData, IDisposable } from 'common/Types';
import { UnicodeV6 } from 'common/input/UnicodeV6';
import { IDecorationOptions, IDecoration } from '@xterm/xterm';
import { Emitter } from 'vs/base/common/event';
import { Emitter, type Event } from 'vs/base/common/event';
export class MockBufferService implements IBufferService {
public serviceBrand: any;
public get buffer(): IBuffer { return this.buffers.active; }
public buffers: IBufferSet = {} as any;
public onResize: IEvent<{ cols: number, rows: number }> = new Emitter<{ cols: number, rows: number }>().event;
public onScroll: IEvent<number> = new Emitter<number>().event;
public onResize: Event<{ cols: number, rows: number }> = new Emitter<{ cols: number, rows: number }>().event;
public onScroll: Event<number> = new Emitter<number>().event;
public isUserScrolling: boolean = false;
constructor(
public cols: number,
@@ -63,7 +62,7 @@ export class MockCoreMouseService implements ICoreMouseService {
public addProtocol(name: string): void { }
public reset(): void { }
public triggerMouseEvent(event: ICoreMouseEvent): boolean { return false; }
public onProtocolChange: IEvent<CoreMouseEventType> = new Emitter<CoreMouseEventType>().event;
public onProtocolChange: Event<CoreMouseEventType> = new Emitter<CoreMouseEventType>().event;
public explainEvents(events: CoreMouseEventType): { [event: string]: boolean } {
throw new Error('Method not implemented.');
}
@@ -95,10 +94,10 @@ export class MockCoreService implements ICoreService {
sendFocus: false,
wraparound: true
};
public onData: IEvent<string> = new Emitter<string>().event;
public onUserInput: IEvent<void> = new Emitter<void>().event;
public onBinary: IEvent<string> = new Emitter<string>().event;
public onRequestScrollToBottom: IEvent<void> = new Emitter<void>().event;
public onData: Event<string> = new Emitter<string>().event;
public onUserInput: Event<void> = new Emitter<void>().event;
public onBinary: Event<string> = new Emitter<string>().event;
public onRequestScrollToBottom: Event<void> = new Emitter<void>().event;
public reset(): void { }
public triggerDataEvent(data: string, wasUserInput?: boolean): void { }
public triggerBinaryEvent(data: string): void { }
@@ -118,7 +117,7 @@ export class MockOptionsService implements IOptionsService {
public serviceBrand: any;
public readonly rawOptions: Required<ITerminalOptions> = clone(DEFAULT_OPTIONS);
public options: Required<ITerminalOptions> = this.rawOptions;
public onOptionChange: IEvent<keyof ITerminalOptions> = new Emitter<keyof ITerminalOptions>().event;
public onOptionChange: Event<keyof ITerminalOptions> = new Emitter<keyof ITerminalOptions>().event;
constructor(testOptions?: Partial<ITerminalOptions>) {
if (testOptions) {
for (const key of Object.keys(testOptions)) {
@@ -170,7 +169,7 @@ export class MockUnicodeService implements IUnicodeService {
}
public versions: string[] = [];
public activeVersion: string = '';
public onChange: IEvent<string> = new Emitter<string>().event;
public onChange: Event<string> = new Emitter<string>().event;
public wcwidth = (codepoint: number): UnicodeCharWidth => this._provider.wcwidth(codepoint);
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
let width = this.wcwidth(codepoint);