diff --git a/packages/vscode-messenger-common/src/messages.ts b/packages/vscode-messenger-common/src/messages.ts index f738835..7407060 100644 --- a/packages/vscode-messenger-common/src/messages.ts +++ b/packages/vscode-messenger-common/src/messages.ts @@ -201,7 +201,7 @@ export class DeferredRequest { * set a listener that is called when the request is canceled. */ export interface CancellationToken { - isCanceled(): boolean; + readonly isCanceled: boolean; onCancel: ((reason: string) => void) | undefined; } @@ -220,7 +220,7 @@ export class CancellationTokenImpl implements CancellationToken { this.onCancel?.(reason); } - public isCanceled(): boolean { + get isCanceled(): boolean { return this.canceled; } diff --git a/packages/vscode-messenger-webview/src/messenger.ts b/packages/vscode-messenger-webview/src/messenger.ts index a37e3c3..91b8a1b 100644 --- a/packages/vscode-messenger-webview/src/messenger.ts +++ b/packages/vscode-messenger-webview/src/messenger.ts @@ -81,7 +81,7 @@ export class Messenger implements MessengerAPI { }; this.vscode.postMessage(response); } catch (error) { - if (cancelable.isCanceled()) { + if (cancelable.isCanceled) { // Don't report the error if request was canceled. return; } diff --git a/packages/vscode-messenger/src/messenger.ts b/packages/vscode-messenger/src/messenger.ts index 2a4392b..2de993d 100644 --- a/packages/vscode-messenger/src/messenger.ts +++ b/packages/vscode-messenger/src/messenger.ts @@ -196,7 +196,7 @@ export class Messenger implements MessengerAPI { this.log(`Failed to send result message: ${participantToString(response.receiver)}`, 'error'); } } catch (error) { - if (cancelable?.isCanceled()) { + if (cancelable?.isCanceled) { // Don't report the error if request was canceled. return; }