Move applicationCursor into core service

This commit is contained in:
Daniel Imms
2019-06-23 14:06:06 -07:00
parent 99a31b3862
commit 33a640a7a8
8 changed files with 32 additions and 10 deletions
+13
View File
@@ -5,8 +5,16 @@
import { ICoreService, IOptionsService, IBufferService } from 'common/services/Services';
import { EventEmitter, IEvent } from 'common/EventEmitter';
import { IDecPrivateModes } from 'common/Types';
import { clone } from 'common/Clone';
const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
applicationCursorKeys: false
});
export class CoreService implements ICoreService {
public decPrivateModes: IDecPrivateModes;
private _onData = new EventEmitter<string>();
public get onData(): IEvent<string> { return this._onData.event; }
private _onUserInput = new EventEmitter<void>();
@@ -18,6 +26,11 @@ export class CoreService implements ICoreService {
private readonly _bufferService: IBufferService,
private readonly _optionsService: IOptionsService
) {
this.decPrivateModes = clone(DEFAULT_DEC_PRIVATE_MODES);
}
public reset(): void {
}
public triggerDataEvent(data: string, wasUserInput: boolean = false): void {
+5
View File
@@ -5,6 +5,7 @@
import { IEvent } from 'common/EventEmitter';
import { IBuffer, IBufferSet } from 'common/buffer/Types';
import { IDecPrivateModes } from 'common/Types';
export interface IBufferService {
readonly cols: number;
@@ -19,9 +20,13 @@ export interface IBufferService {
}
export interface ICoreService {
readonly decPrivateModes: IDecPrivateModes;
readonly onData: IEvent<string>;
readonly onUserInput: IEvent<void>;
reset(): void;
/**
* Triggers the onData event in the public API.
* @param data The data that is being emitted.