File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
extensions/ql-vscode/src/common/vscode Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 1- import { CancellationToken , Disposable } from "vscode" ;
1+ import { CancellationToken , Event , EventEmitter } from "vscode" ;
22
33/**
44 * A cancellation token that cancels when any of its constituent
55 * cancellation tokens are cancelled.
66 */
77export class MultiCancellationToken implements CancellationToken {
88 private readonly tokens : CancellationToken [ ] ;
9+ private readonly onCancellationRequestedEvent = new EventEmitter < void > ( ) ;
910
1011 constructor ( ...tokens : CancellationToken [ ] ) {
1112 this . tokens = tokens ;
13+ tokens . forEach ( ( t ) =>
14+ t . onCancellationRequested ( ( ) => this . onCancellationRequestedEvent . fire ( ) ) ,
15+ ) ;
1216 }
1317
1418 get isCancellationRequested ( ) : boolean {
1519 return this . tokens . some ( ( t ) => t . isCancellationRequested ) ;
1620 }
1721
18- onCancellationRequested < T > ( listener : ( e : T ) => any ) : Disposable {
19- this . tokens . forEach ( ( t ) => t . onCancellationRequested ( listener ) ) ;
20- return {
21- dispose : ( ) => {
22- this . tokens . forEach ( ( t ) =>
23- t . onCancellationRequested ( listener ) . dispose ( ) ,
24- ) ;
25- } ,
26- } ;
22+ get onCancellationRequested ( ) : Event < any > {
23+ return this . onCancellationRequestedEvent . event ;
2724 }
2825}
You can’t perform that action at this time.
0 commit comments