Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor typings tweaks #909

Merged
merged 2 commits into from
Aug 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion typings/xterm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,26 @@ declare module 'xterm' {
* The class that represents an xterm.js terminal.
*/
export class Terminal {
/**
* The element containing the terminal.
*/
element: HTMLElement;

/**
* The textarea that accepts input for the terminal.
*/
textarea: HTMLTextAreaElement;

/**
* The number of rows in the terminal's viewport.
*/
rows: number;

/**
* The number of columns in the terminal's viewport.
*/
cols: number;

/**
* Creates a new `Terminal` object.
*
Expand Down Expand Up @@ -155,13 +172,19 @@ declare module 'xterm' {
* @param listener The listener.
*/
on(type: 'title', listener: (title?: string) => void): void;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
*/
on(type: string, listener: (...args: any[]) => void): void;

/**
* Deregisters an event listener.
* @param type The type of the event.
* @param listener The listener.
*/
off(type: 'blur' | 'focus' | 'lineFeed' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title', listener: (...args: any[]) => void): void;
off(type: 'blur' | 'focus' | 'lineFeed' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void;

/**
* Resizes the terminal.
Expand Down Expand Up @@ -316,6 +339,11 @@ declare module 'xterm' {
* @param key The option key.
*/
getOption(key: 'handler'): (data: string) => void;
/**
* Retrieves an option's value from the terminal.
* @param key The option key.
*/
getOption(key: string): any;

/**
* Sets an option on the terminal.
Expand Down Expand Up @@ -365,6 +393,12 @@ declare module 'xterm' {
* @param value The option value.
*/
setOption(key: 'handler', value: (data: string) => void): void;
/**
* Sets an option on the terminal.
* @param key The option key.
* @param value The option value.
*/
setOption(key: string, value: any): void;

/**
* Tells the renderer to refresh terminal content between two rows
Expand Down