Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 1, 2022
1 parent 08ded97 commit 47840bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
],
"dependencies": {
"eventemitter3": "^4.0.7",
"p-timeout": "^5.0.0"
"p-timeout": "^5.0.2"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^2.0.0",
"@types/benchmark": "^2.1.1",
"@types/node": "^16.7.2",
"ava": "^3.15.0",
"@types/node": "^17.0.13",
"ava": "^4.0.1",
"benchmark": "^2.1.4",
"codecov": "^3.8.3",
"del-cli": "^4.0.1",
Expand All @@ -59,8 +59,8 @@
"nyc": "^15.1.0",
"random-int": "^3.0.0",
"time-span": "^5.0.0",
"ts-node": "^10.2.1",
"typescript": "^4.4.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.5",
"xo": "^0.44.0"
},
"ava": {
Expand All @@ -70,9 +70,6 @@
"extensions": {
"ts": "module"
},
"nonSemVerExperiments": {
"configurableModuleFormat": true
},
"nodeArguments": [
"--loader=ts-node/esm"
]
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ Priority of operation. Operations with greater priority will be scheduled first.

##### signal

*Requires Node.js 16 or later.*

[`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) for cancellation of the operation. When aborted, it will be removed from the queue and the `queue.add()` call will reject with an `AbortError`. If the operation is already running, the signal will need to be handled by the operation itself.

```js
Expand Down
4 changes: 1 addition & 3 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,6 @@ test('should verify timeout overrides passed to add', async t => {

test('should skip an aborted job', async t => {
const queue = new PQueue();

const controller = new AbortController();

controller.abort();
Expand All @@ -1077,10 +1076,9 @@ test('should skip an aborted job', async t => {

test('should pass AbortSignal instance to job', async t => {
const queue = new PQueue();

const controller = new AbortController();

await queue.add(async ({signal}) => {
t.is(controller.signal, signal);
t.is(controller.signal, signal!);
}, {signal: controller.signal});
});

0 comments on commit 47840bd

Please sign in to comment.