Migrate most EventEmitter to base/ Emitter
This commit is contained in:
@@ -9,6 +9,7 @@ import { IAttributeData, IBufferLine } from 'common/Types';
|
||||
import { BufferSet } from 'common/buffer/BufferSet';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
||||
export const MINIMUM_ROWS = 1;
|
||||
@@ -24,7 +25,7 @@ export class BufferService extends Disposable implements IBufferService {
|
||||
|
||||
private readonly _onResize = this.register(new EventEmitter<{ cols: number, rows: number }>());
|
||||
public readonly onResize = this._onResize.event;
|
||||
private readonly _onScroll = this.register(new EventEmitter<number>());
|
||||
private readonly _onScroll = this.register(new Emitter<number>());
|
||||
public readonly onScroll = this._onScroll.event;
|
||||
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* @license MIT
|
||||
*/
|
||||
import { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
/**
|
||||
* Supported default protocols.
|
||||
@@ -175,7 +175,7 @@ export class CoreMouseService extends Disposable implements ICoreMouseService {
|
||||
private _activeEncoding: string = '';
|
||||
private _lastEvent: ICoreMouseEvent | null = null;
|
||||
|
||||
private readonly _onProtocolChange = this.register(new EventEmitter<CoreMouseEventType>());
|
||||
private readonly _onProtocolChange = this.register(new Emitter<CoreMouseEventType>());
|
||||
public readonly onProtocolChange = this._onProtocolChange.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
*/
|
||||
|
||||
import { clone } from 'common/Clone';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { IDecPrivateModes, IModes } from 'common/Types';
|
||||
import { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
const DEFAULT_MODES: IModes = Object.freeze({
|
||||
insertMode: false
|
||||
@@ -31,13 +31,13 @@ export class CoreService extends Disposable implements ICoreService {
|
||||
public modes: IModes;
|
||||
public decPrivateModes: IDecPrivateModes;
|
||||
|
||||
private readonly _onData = this.register(new EventEmitter<string>());
|
||||
private readonly _onData = this.register(new Emitter<string>());
|
||||
public readonly onData = this._onData.event;
|
||||
private readonly _onUserInput = this.register(new EventEmitter<void>());
|
||||
private readonly _onUserInput = this.register(new Emitter<void>());
|
||||
public readonly onUserInput = this._onUserInput.event;
|
||||
private readonly _onBinary = this.register(new EventEmitter<string>());
|
||||
private readonly _onBinary = this.register(new Emitter<string>());
|
||||
public readonly onBinary = this._onBinary.event;
|
||||
private readonly _onRequestScrollToBottom = this.register(new EventEmitter<void>());
|
||||
private readonly _onRequestScrollToBottom = this.register(new Emitter<void>());
|
||||
public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { DecorationService } from './DecorationService';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { IMarker } from 'common/Types';
|
||||
import { Disposable } from 'common/Lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
const fakeMarker: IMarker = Object.freeze(new class extends Disposable {
|
||||
public readonly id = 1;
|
||||
public readonly line = 1;
|
||||
public readonly isDisposed = false;
|
||||
public readonly onDispose = new EventEmitter<void>().event;
|
||||
public readonly onDispose = new Emitter<void>().event;
|
||||
}());
|
||||
|
||||
describe('DecorationService', () => {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
*/
|
||||
|
||||
import { css } from 'common/Color';
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { IDecorationService, IInternalDecoration } from 'common/services/Services';
|
||||
import { SortedList } from 'common/SortedList';
|
||||
import { IColor } from 'common/Types';
|
||||
import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
// Work variables to avoid garbage collection
|
||||
let $xmin = 0;
|
||||
@@ -25,9 +25,9 @@ export class DecorationService extends Disposable implements IDecorationService
|
||||
*/
|
||||
private readonly _decorations: SortedList<IInternalDecoration> = new SortedList(e => e?.marker.line);
|
||||
|
||||
private readonly _onDecorationRegistered = this.register(new EventEmitter<IInternalDecoration>());
|
||||
private readonly _onDecorationRegistered = this.register(new Emitter<IInternalDecoration>());
|
||||
public readonly onDecorationRegistered = this._onDecorationRegistered.event;
|
||||
private readonly _onDecorationRemoved = this.register(new EventEmitter<IInternalDecoration>());
|
||||
private readonly _onDecorationRemoved = this.register(new Emitter<IInternalDecoration>());
|
||||
public readonly onDecorationRemoved = this._onDecorationRemoved.event;
|
||||
|
||||
public get decorations(): IterableIterator<IInternalDecoration> { return this._decorations.values(); }
|
||||
@@ -95,9 +95,9 @@ class Decoration extends Disposable implements IInternalDecoration {
|
||||
public element: HTMLElement | undefined;
|
||||
public get isDisposed(): boolean { return this._isDisposed; }
|
||||
|
||||
public readonly onRenderEmitter = this.register(new EventEmitter<HTMLElement>());
|
||||
public readonly onRenderEmitter = this.register(new Emitter<HTMLElement>());
|
||||
public readonly onRender = this.onRenderEmitter.event;
|
||||
private readonly _onDispose = this.register(new EventEmitter<void>());
|
||||
private readonly _onDispose = this.register(new Emitter<void>());
|
||||
public readonly onDispose = this._onDispose.event;
|
||||
|
||||
private _cachedBg: IColor | undefined | null = null;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { Disposable, toDisposable } from 'common/Lifecycle';
|
||||
import { isMac } from 'common/Platform';
|
||||
import { CursorStyle, IDisposable } from 'common/Types';
|
||||
import { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
||||
cols: 80,
|
||||
@@ -65,7 +65,7 @@ export class OptionsService extends Disposable implements IOptionsService {
|
||||
public readonly rawOptions: Required<ITerminalOptions>;
|
||||
public options: Required<ITerminalOptions>;
|
||||
|
||||
private readonly _onOptionChange = this.register(new EventEmitter<keyof ITerminalOptions>());
|
||||
private readonly _onOptionChange = this.register(new Emitter<keyof ITerminalOptions>());
|
||||
public readonly onOptionChange = this._onOptionChange.event;
|
||||
|
||||
constructor(options: Partial<ITerminalOptions>) {
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
*/
|
||||
|
||||
import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty } from '@xterm/xterm';
|
||||
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
||||
import { IEvent } from 'common/EventEmitter';
|
||||
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||
import type { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
||||
export interface IBufferService {
|
||||
@@ -377,5 +378,5 @@ export interface IInternalDecoration extends IDecoration {
|
||||
readonly options: IDecorationOptions;
|
||||
readonly backgroundColorRGB: IColor | undefined;
|
||||
readonly foregroundColorRGB: IColor | undefined;
|
||||
readonly onRenderEmitter: IEventEmitter<HTMLElement>;
|
||||
readonly onRenderEmitter: Emitter<HTMLElement>;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'common/EventEmitter';
|
||||
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
||||
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class UnicodeService implements IUnicodeService {
|
||||
public serviceBrand: any;
|
||||
@@ -14,7 +14,7 @@ export class UnicodeService implements IUnicodeService {
|
||||
private _active: string = '';
|
||||
private _activeProvider: IUnicodeVersionProvider;
|
||||
|
||||
private readonly _onChange = new EventEmitter<string>();
|
||||
private readonly _onChange = new Emitter<string>();
|
||||
public readonly onChange = this._onChange.event;
|
||||
|
||||
public static extractShouldJoin(value: UnicodeCharProperties): boolean {
|
||||
|
||||
Reference in New Issue
Block a user