Fix tsconfigs, IDisposable, and add comments

This commit is contained in:
Ayman Bagabas
2023-09-21 10:26:46 -04:00
parent db5bfc7525
commit b22762b472
9 changed files with 26 additions and 34 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
},
"main": "lib/xterm-addon-clipboard.js",
"types": "typings/xterm-addon-clipboard.d.ts",
"repository": "https://github.com/xtermjs/xterm.js",
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-clipboard",
"license": "MIT",
"keywords": [
"terminal",
@@ -4,18 +4,17 @@
*/
import { ClipboardProvider } from './ClipboardProvider';
import { IClipboardProvider, ITerminalAddon, Terminal } from 'xterm';
import { IClipboardProvider, IDisposable, ITerminalAddon, Terminal } from 'xterm';
export class ClipboardAddon implements ITerminalAddon {
private _terminal: Terminal | undefined;
private _disposable: IDisposable | undefined;
constructor(private _provider: IClipboardProvider = new ClipboardProvider()) {}
public activate(terminal: Terminal): void {
this._terminal = terminal;
terminal.registerClipboardProvider(this._provider);
this._disposable = terminal.registerClipboardProvider(this._provider);
}
public dispose(): void {
this._terminal?.deregisterClipboardProvider();
return this._disposable?.dispose();
}
}
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"target": "es2021",
"sourceMap": true,
"outDir": "../out",
"rootDir": ".",
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"target": "es2021",
"lib": [
"es2015"
"es2021"
],
"rootDir": ".",
"outDir": "../out-test",
@@ -19,4 +19,4 @@
"./**/*",
"../../../typings/xterm.d.ts"
]
}
}