File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1- export interface SimpleDebounce {
1+ import { Disposable } from 'vscode' ;
2+ export interface SimpleDebounce extends Disposable {
23 trigger ( ) : void ;
34}
45
5- class SimpleDebounceImpl {
6+ class SimpleDebounceImpl implements SimpleDebounce {
67 private timeout : NodeJS . Timeout | undefined ;
78
89 constructor ( private readonly ms : number , private readonly callback : ( ) => void ) { }
910
10- public trigger ( ) {
11+ public trigger ( ) : void {
1112 if ( this . timeout ) {
1213 clearTimeout ( this . timeout ) ;
1314 }
1415 this . timeout = setTimeout ( ( ) => {
1516 this . callback ( ) ;
1617 } , this . ms ) ;
1718 }
19+
20+ public dispose ( ) : void {
21+ if ( this . timeout ) {
22+ clearTimeout ( this . timeout ) ;
23+ this . timeout = undefined ;
24+ }
25+ }
1826}
1927
2028export function createSimpleDebounce ( ms : number , callback : ( ) => void ) : SimpleDebounce {
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ export async function waitForShellIntegration(terminal: Terminal): Promise<boole
5757 resolve ( false ) ;
5858 }
5959 } ) ;
60+ disposables . push ( debounced ) ;
6061 disposables . push (
6162 onDidWriteTerminalData ( ( e ) => {
6263 if ( e . terminal === terminal ) {
You can’t perform that action at this time.
0 commit comments