From f4e91ed470dbb8f8063faddada9e0cefec909c94 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 3 Nov 2022 11:40:44 +0100 Subject: [PATCH] inline CancellationToken --- api.d.ts | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/api.d.ts b/api.d.ts index 8076797..d64e4fc 100644 --- a/api.d.ts +++ b/api.d.ts @@ -12,7 +12,7 @@ export interface XHROptions { data?: string; strictSSL?: boolean; followRedirects?: number; - token?: import("vscode-jsonrpc").CancellationToken; + token?: CancellationToken; agent?: HttpProxyAgent | HttpsProxyAgent; } @@ -31,6 +31,41 @@ export interface XHRConfigure { (proxyUrl: string | undefined, strictSSL: boolean): void; } +export interface Disposable { + /** + * Dispose this object. + */ + dispose(): void; +} +/** + * Represents a typed event. + */ + export interface Event { + /** + * + * @param listener The listener function will be call when the event happens. + * @param thisArgs The 'this' which will be used when calling the event listener. + * @param disposables An array to which a {{IDisposable}} will be added. The + * @return + */ + (listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable; +} +/** + * Defines a CancellationToken. This interface is not + * intended to be implemented. A CancellationToken must + * be created via a CancellationTokenSource. + */ + export interface CancellationToken { + /** + * Is `true` when the token has been cancelled, `false` otherwise. + */ + readonly isCancellationRequested: boolean; + /** + * An [event](#Event) which fires upon cancellation. + */ + readonly onCancellationRequested: Event; +} + export type HttpProxyAgent = import('http-proxy-agent').HttpProxyAgent; export type HttpsProxyAgent = import('https-proxy-agent').HttpsProxyAgent;