diff --git a/README.md b/README.md index 56b0309..29ad995 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ This package provides synchronization objects that use `Atomics` to cross the th This is the web worker equivalent of `AbortController` and provides a token that can be passed to workers in a task's payload. -The worker can use `CancellationSource.isSignalled()` or `CancellationSource.throwIfSignaled()` through polling in order +The worker can use `CancellationSource.isSignalled()` or `CancellationSource.throwIfSignalled()` through polling in order to abort the current work: ```typescript @@ -268,7 +268,7 @@ import { CancellationSource, type Token } from '@wjfe/async-workers'; function computeSomeStuff(cancelToken?: Token) { for (let i = 0; i < Number.MAX_SAFE_INTEGER; ++i) { // No thowing will be done if cancelToken is undefined. - CancellationSource.throwIfSignaled(cancelToken); + CancellationSource.throwIfSignalled(cancelToken); ... } } diff --git a/pages/src/workers/exampleWorker.ts b/pages/src/workers/exampleWorker.ts index a758dd6..17ae34c 100644 --- a/pages/src/workers/exampleWorker.ts +++ b/pages/src/workers/exampleWorker.ts @@ -3,7 +3,7 @@ import { CancellationSource, ManualResetEvent, workerListener, type PostFn, type function isPrime(n: number, cancelToken?: Token) { // Made unecessarily inefficient for demo purposes. for (let i = 2; i <= n / 2; ++i) { - CancellationSource.throwIfSignaled(cancelToken); + CancellationSource.throwIfSignalled(cancelToken); if (n % i === 0) { return false; } @@ -14,7 +14,7 @@ function isPrime(n: number, cancelToken?: Token) { function isPrimePausable(n: number, pause: Token, cancelToken?: Token) { // Made unecessarily inefficient for demo purposes. for (let i = 2; i <= n / 2; ++i) { - CancellationSource.throwIfSignaled(cancelToken); + CancellationSource.throwIfSignalled(cancelToken); ManualResetEvent.wait(pause); if (n % i === 0) { return false;