Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
...
}
}
Expand Down
4 changes: 2 additions & 2 deletions pages/src/workers/exampleWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down