@common.js/p-timeout 6.1.2 → 6.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +7 -1
  3. package/package.json +3 -1
package/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  The [p-timeout](https://www.npmjs.com/package/p-timeout) package exported as CommonJS modules.
4
4
 
5
- Exported from [p-timeout@6.1.2](https://www.npmjs.com/package/p-timeout/v/6.1.2) using https://github.com/etienne-martin/common.js.
5
+ Exported from [p-timeout@6.1.3](https://www.npmjs.com/package/p-timeout/v/6.1.3) using https://github.com/etienne-martin/common.js.
package/index.js CHANGED
@@ -331,8 +331,14 @@ function pTimeout(promise, options) {
331
331
  if (signal.aborted) {
332
332
  reject(getAbortedReason(signal));
333
333
  }
334
- signal.addEventListener("abort", function() {
334
+ var abortHandler = function() {
335
335
  reject(getAbortedReason(signal));
336
+ };
337
+ signal.addEventListener("abort", abortHandler, {
338
+ once: true
339
+ });
340
+ promise.finally(function() {
341
+ signal.removeEventListener("abort", abortHandler);
336
342
  });
337
343
  }
338
344
  if (milliseconds === Number.POSITIVE_INFINITY) {
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@common.js/p-timeout",
3
- "version": "6.1.2",
3
+ "version": "6.1.3",
4
4
  "description": "p-timeout package exported as CommonJS modules",
5
5
  "license": "MIT",
6
6
  "repository": "etienne-martin/common.js",
7
7
  "funding": "https://github.com/sponsors/sindresorhus",
8
8
  "type": "commonjs",
9
9
  "types": "./index.d.ts",
10
+ "sideEffects": false,
10
11
  "engines": {
11
12
  "node": ">=14.16"
12
13
  },
@@ -22,6 +23,7 @@
22
23
  "delay": "^5.0.0",
23
24
  "in-range": "^3.0.0",
24
25
  "p-cancelable": "^4.0.1",
26
+ "sinon": "^19.0.2",
25
27
  "time-span": "^5.1.0",
26
28
  "tsd": "^0.22.0",
27
29
  "xo": "^0.54.2"