Base ITerminal on interface in .d.ts

Part of #1221
This commit is contained in:
Daniel Imms
2018-01-19 09:48:33 -08:00
parent d33c340de5
commit 47df04976c
7 changed files with 96 additions and 69 deletions
+10 -2
View File
@@ -172,10 +172,16 @@ declare module 'xterm' {
priority?: number;
}
export interface IEventEmitter {
on(type: string, listener: (...args: any[]) => void): void;
off(type: string, listener: (...args: any[]) => void): void;
emit(type: string, data?: any): void;
}
/**
* The class that represents an xterm.js terminal.
*/
export class Terminal {
export class Terminal implements IEventEmitter {
/**
* The element containing the terminal.
*/
@@ -224,7 +230,7 @@ declare module 'xterm' {
* @param type The type of the event.
* @param listener The listener.
*/
on(type: 'data', listener: (data?: string) => void): void;
on(type: 'data', listener: (...args: any[]) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
@@ -275,6 +281,8 @@ declare module 'xterm' {
*/
off(type: 'blur' | 'focus' | 'linefeed' | 'selection' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void;
emit(type: string, data?: any): void;
/**
* Resizes the terminal.
* @param x The number of columns to resize to.