Created
December 21, 2023 09:30
-
-
Save garenyondem/4844382f5b7e5d9cbbd9a75f0d85f5a8 to your computer and use it in GitHub Desktop.
C# style CancellationToken implementation in Typescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class CancellationToken { | |
#isCancellationRequested: boolean = false; | |
get isCancellationRequested() { | |
return this.#isCancellationRequested; | |
} | |
cancel() { | |
this.#isCancellationRequested = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment