@jsenv/abort
Advanced tools
Comparing version 3.1.1 to 3.1.2
{ | ||
"name": "@jsenv/abort", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Help to write code compatible with abort signals", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -7,6 +7,5 @@ /* | ||
let cleanCallbacks = [] | ||
let done = false | ||
let status = "racing" | ||
const cancel = () => { | ||
done = true | ||
const clean = () => { | ||
cleanCallbacks.forEach((clean) => { | ||
@@ -18,8 +17,18 @@ clean() | ||
const cancel = () => { | ||
if (status !== "racing") { | ||
return | ||
} | ||
status = "cancelled" | ||
clean() | ||
} | ||
Object.keys(raceDescription).forEach((candidateName) => { | ||
const register = raceDescription[candidateName] | ||
const returnValue = register((data) => { | ||
if (done) return | ||
done = true | ||
cancel() | ||
if (status !== "racing") { | ||
return | ||
} | ||
status = "done" | ||
clean() | ||
winnerCallback({ | ||
@@ -26,0 +35,0 @@ name: candidateName, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18890
405