Skip to content

Instantly share code, notes, and snippets.

@garenyondem
Created December 21, 2023 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garenyondem/4844382f5b7e5d9cbbd9a75f0d85f5a8 to your computer and use it in GitHub Desktop.
Save garenyondem/4844382f5b7e5d9cbbd9a75f0d85f5a8 to your computer and use it in GitHub Desktop.
C# style CancellationToken implementation in Typescript
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