Skip to content

Commit

Permalink
isCanceled as a readonly property
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuebner committed Dec 20, 2023
1 parent 57d618e commit 4655562
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/vscode-messenger-common/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class DeferredRequest<R = any> {
* set a listener that is called when the request is canceled.
*/
export interface CancellationToken {
isCanceled(): boolean;
readonly isCanceled: boolean;
onCancel: ((reason: string) => void) | undefined;
}

Expand All @@ -220,7 +220,7 @@ export class CancellationTokenImpl implements CancellationToken {
this.onCancel?.(reason);
}

public isCanceled(): boolean {
get isCanceled(): boolean {
return this.canceled;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-messenger-webview/src/messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-messenger/src/messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4655562

Please sign in to comment.