{"_id":"abort-controller-x","_rev":"3816578","name":"abort-controller-x","description":"Abortable async function helpers","dist-tags":{"latest":"0.4.3"},"maintainers":[{"name":"aikoven","email":""}],"time":{"modified":"2025-06-05T11:30:40.000Z","created":"2020-10-11T06:15:56.614Z","0.4.3":"2023-07-14T07:25:30.409Z","0.4.2":"2023-05-24T06:55:55.419Z","0.4.1":"2022-09-30T04:51:10.719Z","0.4.0":"2022-08-10T12:23:20.714Z","0.3.0":"2022-07-22T03:06:21.592Z","0.2.7":"2022-07-11T09:51:51.776Z","0.2.6":"2021-05-24T08:54:25.662Z","0.2.5":"2021-05-07T10:24:24.221Z","0.2.4":"2021-04-13T09:48:30.138Z","0.2.3":"2021-04-09T03:53:14.205Z","0.2.2":"2021-02-14T06:19:01.662Z","0.2.1":"2021-02-11T10:10:52.035Z","0.2.0":"2020-12-15T08:04:16.182Z","0.1.3":"2020-11-04T04:21:18.290Z","0.1.2":"2020-10-28T04:28:04.910Z","0.1.1":"2020-10-26T04:46:57.947Z","0.1.0":"2020-10-11T06:15:56.614Z"},"users":{},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"versions":{"0.4.3":{"name":"abort-controller-x","version":"0.4.3","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^28.1.6","@types/node":"^14.17.0","defer-promise":"^2.0.1","jest":"^28.1.3","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^28.0.7","typescript":"^4.7.4"},"gitHead":"3b36ce7a6dbc04a739038c6f1ad2c6c014dc5b9f","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.4.3","_nodeVersion":"16.20.0","_npmVersion":"8.19.4","dist":{"shasum":"ff269788386fabd58a7b6eeaafcb6cf55c2958e0","size":28404,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.4.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.4.3.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.4.3_1689319530212_0.6974075949658931"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-07-14T07:25:30.409Z","publish_time":1689319530409,"_source_registry_name":"default","_cnpm_publish_time":1689319530409},"0.4.2":{"name":"abort-controller-x","version":"0.4.2","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^28.1.6","@types/node":"^14.17.0","defer-promise":"^2.0.1","jest":"^28.1.3","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^28.0.7","typescript":"^4.7.4"},"gitHead":"c4c5e6e9556b5ade07255bd77a81c892d3412664","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.4.2","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"shasum":"66dae3c510706b407915af6ecc420ded1e616f08","size":26687,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.4.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.4.2.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.4.2_1684911355238_0.4645632112118785"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-24T06:55:55.419Z","publish_time":1684911355419,"_source_registry_name":"default","_cnpm_publish_time":1684911355419},"0.4.1":{"name":"abort-controller-x","version":"0.4.1","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^28.1.6","@types/node":"^14.17.0","defer-promise":"^2.0.1","jest":"^28.1.3","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^28.0.7","typescript":"^4.7.4"},"gitHead":"bf9aa2abd0976ed9a61a2aae61297dda2faa8882","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.4.1","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"shasum":"b2eefab8503897e0bbdf3dd7a4d33e05ea1ffce9","size":26684,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.4.1.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.4.1_1664513470537_0.42028453923583586"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-30T04:55:02.976Z","publish_time":1664513470719,"_cnpm_publish_time":1664513470719},"0.4.0":{"name":"abort-controller-x","version":"0.4.0","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^28.1.6","@types/node":"^14.17.0","defer-promise":"^2.0.1","jest":"^28.1.3","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^28.0.7","typescript":"^4.7.4"},"gitHead":"10f21c928fc91e685bb7736c9f53c426d233dbdf","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.4.0","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"shasum":"fde25da52548c7ff3d8b3b32dffc943452874d5f","size":26594,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.4.0.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.4.0_1660134200485_0.6224017249956233"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-08-10T12:25:17.846Z","publish_time":1660134200714,"_cnpm_publish_time":1660134200714},"0.3.0":{"name":"abort-controller-x","version":"0.3.0","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"type":"module","exports":"./lib/index.js","typings":"./lib/index.d.ts","scripts":{"clean":"rimraf lib","test":"jest","build":"tsc -P tsconfig.build.json","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^28.1.6","@types/node":"^14.17.0","defer-promise":"^2.0.1","jest":"^28.1.3","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^28.0.7","typescript":"^4.7.4"},"gitHead":"ae24426cab2cc597797c441f46811c518043e9f1","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.3.0","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"shasum":"f11f7523c15b84b7669b8871714182535ec35c9d","size":23637,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.3.0.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.3.0_1658459181422_0.5887500926982094"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-07-22T03:11:10.707Z","publish_time":1658459181592,"_cnpm_publish_time":1658459181592},"0.2.7":{"name":"abort-controller-x","version":"0.2.7","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.2.1 || ^2.0.0"},"gitHead":"b1a4ea2e2783a7f24aea420e3cb9b627f7381725","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.7","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"shasum":"6fa9be5b278b9c533d4d078d0ba660d40683907e","size":26610,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.7.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.7_1657533111604_0.7312480415878291"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-07-11T10:20:07.095Z","publish_time":1657533111776,"_cnpm_publish_time":1657533111776},"0.2.6":{"name":"abort-controller-x","version":"0.2.6","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.2.1 || ^2.0.0"},"gitHead":"1c9c0d3537942521a9a47c2ff8d517e06acd2c4d","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.6","_nodeVersion":"15.8.0","_npmVersion":"7.11.2","dist":{"shasum":"708d5fc50a9bccfdf04ec70e562c925cc6f5b4ad","size":26232,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.6.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.6_1621846465522_0.4586731954569503"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:55:07.500Z","publish_time":1621846465662,"_cnpm_publish_time":1621846465662},"0.2.5":{"name":"abort-controller-x","version":"0.2.5","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.2.1"},"gitHead":"84776886105457c536a9cd6b604c2f9bf9a4b253","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.5","_nodeVersion":"15.8.0","_npmVersion":"7.11.2","dist":{"shasum":"e6eccfc461021cec3bb325eed57f871f90373e27","size":26226,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.5.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.5_1620383064107_0.986224851023968"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:55:06.419Z","publish_time":1620383064221,"_cnpm_publish_time":1620383064221},"0.2.4":{"name":"abort-controller-x","version":"0.2.4","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.2.1"},"gitHead":"97b6158281d8c6893add4fb19214275654462419","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.4","_nodeVersion":"15.8.0","_npmVersion":"7.5.0","dist":{"shasum":"9ac58a24685825a6fd0ccbee8ef14b0e46b8d66b","size":26602,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.4.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.4_1618307309961_0.7269823434908684"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:55:05.332Z","publish_time":1618307310138,"_cnpm_publish_time":1618307310138},"0.2.3":{"name":"abort-controller-x","version":"0.2.3","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.2.1"},"gitHead":"7bf7e2f735860b2cf6c70173591e23b5d0330fe4","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.3","_nodeVersion":"15.8.0","_npmVersion":"7.5.0","dist":{"shasum":"1a5886a94f98f2fa0711c1fa826393ecbb4eea50","size":26369,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.3.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.3_1617940394040_0.369150661867081"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:55:04.213Z","publish_time":1617940394205,"_cnpm_publish_time":1617940394205},"0.2.2":{"name":"abort-controller-x","version":"0.2.2","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"aikoven@deeplay.io"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.1.0"},"gitHead":"9f833af2f54af5ded780f76d7c59ec9e83de49aa","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.2","_nodeVersion":"15.8.0","_npmVersion":"7.5.0","dist":{"shasum":"69388500b63c3c738c5c21628e1bacee3129a43a","size":23766,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.2.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.2_1613283541527_0.4882868052470084"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:55:03.133Z","publish_time":1613283541662,"_cnpm_publish_time":1613283541662},"0.2.1":{"name":"abort-controller-x","version":"0.2.1","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"dan.lytkin@gmail.com"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.1.0"},"gitHead":"0a998d1733e3925f0e6bc0a08eb7bb4eaf271184","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.1","_nodeVersion":"15.8.0","_npmVersion":"7.5.0","dist":{"shasum":"ea619f03d7625813ab8b8b8e07912712a8d3bc43","size":23779,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.1.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.1_1613038251900_0.8134585638102012"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:55:02.030Z","publish_time":1613038252035,"_cnpm_publish_time":1613038252035},"0.2.0":{"name":"abort-controller-x","version":"0.2.0","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"dan.lytkin@gmail.com"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"node-abort-controller":"^1.1.0"},"gitHead":"088ee868ed1ac9718c5f9f98bd90431d633e3b72","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.2.0","_nodeVersion":"14.3.0","_npmVersion":"6.14.4","dist":{"shasum":"462ea0871643a766d0dea1ed329f1fcdda466663","size":23791,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.2.0.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.2.0_1608019456051_0.1459792838157885"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:55:00.922Z","publish_time":1608019456182,"_cnpm_publish_time":1608019456182},"0.1.3":{"name":"abort-controller-x","version":"0.1.3","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"dan.lytkin@gmail.com"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"abort-controller":"^3.0.0"},"gitHead":"a2c0754dbfac3b7ca2d2b54a7f2303d9bd768fd1","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.1.3","_nodeVersion":"14.3.0","_npmVersion":"6.14.4","dist":{"shasum":"e9497583262c6a81f6e35a52073fa898346381bd","size":23806,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.1.3.tgz"},"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"maintainers":[{"name":"aikoven","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.1.3_1604463678150_0.3389940483778253"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:54:59.926Z","publish_time":1604463678290,"_cnpm_publish_time":1604463678290},"0.1.2":{"name":"abort-controller-x","version":"0.1.2","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"dan.lytkin@gmail.com"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"abort-controller":"^3.0.0"},"gitHead":"2022ab5b10701f62c98abac2fe26ef54eb2150a1","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.1.2","_nodeVersion":"14.3.0","_npmVersion":"6.14.4","dist":{"shasum":"5b519d3616be98c95ff52d768b86b06242f12f07","size":23699,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.1.2.tgz"},"maintainers":[{"name":"aikoven","email":""}],"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.1.2_1603859284781_0.38214510548328295"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:54:58.834Z","publish_time":1603859284910,"_cnpm_publish_time":1603859284910},"0.1.1":{"name":"abort-controller-x","version":"0.1.1","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"dan.lytkin@gmail.com"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"abort-controller":"^3.0.0"},"gitHead":"e883f1f8377286b54f5f445d07a82cd2d9c65e07","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.1.1","_nodeVersion":"14.3.0","_npmVersion":"6.14.4","dist":{"shasum":"de44cdc952522ad67bd46c4d20d0de9b76a1637a","size":23559,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.1.1.tgz"},"maintainers":[{"name":"aikoven","email":""}],"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.1.1_1603687617823_0.8146765446776447"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:54:57.536Z","publish_time":1603687617947,"_cnpm_publish_time":1603687617947},"0.1.0":{"name":"abort-controller-x","version":"0.1.0","description":"Abortable async function helpers","keywords":["abort","abortable","cancel","cancelable","cancellable","abort-controller","async","coroutine"],"repository":{"type":"git","url":"git+https://github.com/deeplay-io/abort-controller-x.git"},"sideEffects":false,"main":"lib/index.js","module":"es/index.js","typings":"lib/index.d.ts","scripts":{"clean":"rimraf lib es","test":"jest","build:lib":"tsc -P tsconfig.build.json","build:es":"tsc -P tsconfig.es.json","build":"npm run build:lib && npm run build:es","prepublishOnly":"npm test && npm run clean && npm run build"},"author":{"name":"Daniel Lytkin","email":"dan.lytkin@gmail.com"},"license":"MIT","devDependencies":{"@types/defer-promise":"^1.0.0","@types/jest":"^26.0.14","defer-promise":"^2.0.1","jest":"^26.5.0","prettier":"^2.1.2","rimraf":"^2.6.3","ts-jest":"^26.4.1","typescript":"^4.0.3"},"dependencies":{"abort-controller":"^3.0.0"},"gitHead":"c5b6652bb6a481c06d5ac94768438c4862374d83","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","_id":"abort-controller-x@0.1.0","_nodeVersion":"14.3.0","_npmVersion":"6.14.4","dist":{"shasum":"15caea9849cd9a6c298e3320d26d57c891144714","size":22775,"noattachment":false,"key":"/abort-controller-x/-/abort-controller-x-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/abort-controller-x/download/abort-controller-x-0.1.0.tgz"},"maintainers":[{"name":"aikoven","email":""}],"_npmUser":{"name":"aikoven","email":"dan.lytkin@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abort-controller-x_0.1.0_1602396956450_0.6018037718766724"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-26T22:54:56.249Z","publish_time":1602396956614,"_cnpm_publish_time":1602396956614}},"readme":"# Abort Controller Extras [![npm version][npm-image]][npm-url]\n\nAbortable async function primitives and combinators.\n\n- [Installation](#installation)\n- [Abort Controller](#abort-controller)\n- [Abortable Functions](#abortable-functions)\n- [Composing Abortable Functions](#composing-abortable-functions)\n- [Companion Packages](#companion-packages)\n- [API](#api)\n  - [`all`](#all)\n  - [`race`](#race)\n  - [`delay`](#delay)\n  - [`waitForEvent`](#waitforevent)\n  - [`forever`](#forever)\n  - [`spawn`](#spawn)\n  - [`retry`](#retry)\n  - [`proactiveRetry`](#proactive-retry)\n  - [`execute`](#execute)\n  - [`abortable`](#abortable)\n  - [`run`](#run)\n  - [`AbortError`](#aborterror)\n  - [`isAbortError`](#isaborterror)\n  - [`throwIfAborted`](#throwifaborted)\n  - [`rethrowAbortError`](#rethrowaborterror)\n  - [`catchAbortError`](#catchaborterror)\n\n## Installation\n\n```\nyarn add abort-controller-x\n```\n\n## Abort Controller\n\nSee\n[`AbortController` MDN page](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).\nAbortController is\n[available in NodeJS](https://nodejs.org/api/globals.html#class-abortcontroller)\nsince 15.0.0, NodeJS 14.17+ requires the\n[--experimental-abortcontroller](https://nodejs.org/docs/latest-v14.x/api/cli.html#cli_experimental_abortcontroller)\nflag. A [polyfill](https://www.npmjs.com/package/abort-controller) is available\nfor older NodeJS versions and browsers.\n\n## Abortable Functions\n\nWe define _abortable function_ as a function that obeys following rules:\n\n- It must accept `AbortSignal` in its arguments.\n- It must return a `Promise`.\n- It must add\n  [`abort`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event)\n  event listener to the `AbortSignal`. Once the `AbortSignal` is aborted, the\n  returned `Promise` must reject with `AbortError` either immediately, or after\n  doing any async cleanup. It's also possible to reject with other errors that\n  happen during cleanup.\n- Once the returned `Promise` is fulfilled or rejected, it must remove\n  [`abort`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event)\n  event listener.\n\nAn example of _abortable function_ is the standard\n[`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) function.\n\n## Composing Abortable Functions\n\nThis library provides a way to build complex abortable functions using standard\n`async`/`await` syntax, without the burden of manually managing\n[`abort`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event)\nevent listeners. You can reuse a single `AbortSignal` between many operations\ninside a parent function:\n\n```ts\n/**\n * Make requests repeatedly with a delay between consecutive requests\n */\nasync function makeRequests(signal: AbortSignal): Promise<never> {\n  while (true) {\n    await fetch('...', {signal});\n    await delay(signal, 1000);\n  }\n}\n\nconst abortController = new AbortController();\n\nmakeRequests(abortController.signal).catch(catchAbortError);\n\nprocess.on('SIGTERM', () => {\n  abortController.abort();\n});\n```\n\nThe above example can be rewritten in a more ergonomic way using [`run`](#run)\nhelper.\n\nUsually you should only create `AbortController` somewhere on the top level, and\nin regular code use `async`/`await` and pass `AbortSignal` to abortable\nfunctions provided by this library or custom ones composed of other abortable\nfunctions.\n\n## Companion Packages\n\n- [`abort-controller-x-rxjs`](https://github.com/deeplay-io/abort-controller-x-rxjs)\n  — Abortable helpers for RxJS.\n\n## API\n\n### `all`\n\n```ts\nfunction all<T>(\n  signal: AbortSignal,\n  executor: (innerSignal: AbortSignal) => readonly PromiseLike<T>[],\n): Promise<T[]>;\n```\n\nAbortable version of `Promise.all`.\n\nCreates new inner `AbortSignal` and passes it to `executor`. That signal is\naborted when `signal` is aborted or any of the promises returned from `executor`\nare rejected.\n\nReturns a promise that fulfills with an array of results when all of the\npromises returned from `executor` fulfill, rejects when any of the promises\nreturned from `executor` are rejected, and rejects with `AbortError` when\n`signal` is aborted.\n\nThe promises returned from `executor` must be abortable, i.e. once `innerSignal`\nis aborted, they must reject with `AbortError` either immediately, or after\ndoing any async cleanup.\n\nExample:\n\n```ts\nconst [result1, result2] = await all(signal, signal => [\n  makeRequest(signal, params1),\n  makeRequest(signal, params2),\n]);\n```\n\n### `race`\n\n```ts\nfunction race<T>(\n  signal: AbortSignal,\n  executor: (innerSignal: AbortSignal) => readonly PromiseLike<T>[],\n): Promise<T>;\n```\n\nAbortable version of `Promise.race`.\n\nCreates new inner `AbortSignal` and passes it to `executor`. That signal is\naborted when `signal` is aborted or any of the promises returned from `executor`\nare fulfilled or rejected.\n\nReturns a promise that fulfills or rejects when any of the promises returned\nfrom `executor` are fulfilled or rejected, and rejects with `AbortError` when\n`signal` is aborted.\n\nThe promises returned from `executor` must be abortable, i.e. once `innerSignal`\nis aborted, they must reject with `AbortError` either immediately, or after\ndoing any async cleanup.\n\nExample:\n\n```ts\nconst result = await race(signal, signal => [\n  delay(signal, 1000).then(() => ({status: 'timeout'})),\n  makeRequest(signal, params).then(value => ({status: 'success', value})),\n]);\n\nif (result.status === 'timeout') {\n  // request timed out\n} else {\n  const response = result.value;\n}\n```\n\n### `delay`\n\n```ts\nfunction delay(signal: AbortSignal, dueTime: number | Date): Promise<void>;\n```\n\nReturn a promise that resolves after delay and rejects with `AbortError` once\n`signal` is aborted.\n\nThe delay time is specified as a `Date` object or as an integer denoting\nmilliseconds to wait.\n\nExample:\n\n```ts\n// Make a request repeatedly with a delay between consecutive requests\nwhile (true) {\n  await makeRequest(signal, params);\n  await delay(signal, 1000);\n}\n```\n\nExample:\n\n```ts\n// Make a request repeatedly with a fixed interval\nimport {addMilliseconds} from 'date-fns';\n\nlet date = new Date();\n\nwhile (true) {\n  await makeRequest(signal, params);\n\n  date = addMilliseconds(date, 1000);\n  await delay(signal, date);\n}\n```\n\n### `waitForEvent`\n\n```ts\nfunction waitForEvent<T>(\n  signal: AbortSignal,\n  target: EventTargetLike<T>,\n  eventName: string,\n  options?: EventListenerOptions,\n): Promise<T>;\n```\n\nReturns a promise that fulfills when an event of specific type is emitted from\ngiven event target and rejects with `AbortError` once `signal` is aborted.\n\nExample:\n\n```ts\n// Create a WebSocket and wait for connection\nconst webSocket = new WebSocket(url);\n\nconst openEvent = await race(signal, signal => [\n  waitForEvent<WebSocketEventMap['open']>(signal, webSocket, 'open'),\n  waitForEvent<WebSocketEventMap['close']>(signal, webSocket, 'close').then(\n    event => {\n      throw new Error(`Failed to connect to ${url}: ${event.reason}`);\n    },\n  ),\n]);\n```\n\n### `forever`\n\n```ts\nfunction forever(signal: AbortSignal): Promise<never>;\n```\n\nReturn a promise that never fulfills and only rejects with `AbortError` once\n`signal` is aborted.\n\n### `spawn`\n\n```ts\nfunction spawn<T>(\n  signal: AbortSignal,\n  fn: (signal: AbortSignal, effects: SpawnEffects) => Promise<T>,\n): Promise<T>;\n\ntype SpawnEffects = {\n  defer(fn: () => void | Promise<void>): void;\n  fork<T>(fn: (signal: AbortSignal) => Promise<T>): ForkTask<T>;\n};\n\ntype ForkTask<T> = {\n  abort(): void;\n  join(): Promise<T>;\n};\n```\n\nRun an abortable function with `fork` and `defer` effects attached to it.\n\n`spawn` allows to write Go-style coroutines.\n\n- `SpawnEffects.defer`\n\n  Schedules a function to run after spawned function finishes.\n\n  Deferred functions run serially in last-in-first-out order.\n\n  Promise returned from `spawn` resolves or rejects only after all deferred\n  functions finish.\n\n- `SpawnEffects.fork`\n\n  Executes an abortable function in background.\n\n  If a forked function throws an exception, spawned function and other forks are\n  aborted and promise returned from `spawn` rejects with that exception.\n\n  When spawned function finishes, all forks are aborted.\n\n- `ForkTask.abort`\n\n  Abort a forked function.\n\n- `ForkTask.join`\n\n  Returns a promise returned from a forked function.\n\nExample:\n\n```ts\n// Connect to a database, then start a server, then block until abort.\n// On abort, gracefully shutdown the server, and once done, disconnect\n// from the database.\nspawn(signal, async (signal, {defer}) => {\n  const db = await connectToDb();\n\n  defer(async () => {\n    await db.close();\n  });\n\n  const server = await startServer(db);\n\n  defer(async () => {\n    await server.close();\n  });\n\n  await forever(signal);\n});\n```\n\nExample:\n\n```ts\n// Connect to a database, then start an infinite polling loop.\n// On abort, disconnect from the database.\nspawn(signal, async (signal, {defer}) => {\n  const db = await connectToDb();\n\n  defer(async () => {\n    await db.close();\n  });\n\n  while (true) {\n    await poll(signal, db);\n    await delay(signal, 5000);\n  }\n});\n```\n\nExample:\n\n```ts\n// Acquire a lock and execute a function.\n// Extend the lock while the function is running.\n// Once the function finishes or the signal is aborted, stop extending\n// the lock and release it.\nimport Redlock = require('redlock');\n\nconst lockTtl = 30_000;\n\nfunction withLock<T>(\n  signal: AbortSignal,\n  redlock: Redlock,\n  key: string,\n  fn: (signal: AbortSignal) => Promise<T>,\n): Promise<T> {\n  return spawn(signal, async (signal, {fork, defer}) => {\n    const lock = await redlock.lock(key, lockTtl);\n\n    defer(() => lock.unlock());\n\n    fork(async signal => {\n      while (true) {\n        await delay(signal, lockTtl / 10);\n        await lock.extend(lockTtl);\n      }\n    });\n\n    return await fn(signal);\n  });\n}\n\nconst redlock = new Redlock([redis], {\n  retryCount: -1,\n});\n\nawait withLock(signal, redlock, 'the-lock-key', async signal => {\n  // ...\n});\n```\n\n### `retry`\n\n```ts\nfunction retry<T>(\n  signal: AbortSignal,\n  fn: (signal: AbortSignal, attempt: number, reset: () => void) => Promise<T>,\n  options?: RetryOptions,\n): Promise<T>;\n\ntype RetryOptions = {\n  baseMs?: number;\n  maxDelayMs?: number;\n  maxAttempts?: number;\n  onError?: (error: unknown, attempt: number, delayMs: number) => void;\n};\n```\n\nRetry a function with exponential backoff.\n\n- `fn`\n\n  A function that will be called and retried in case of error. It receives:\n\n  - `signal`\n\n    `AbortSignal` that is aborted when the signal passed to `retry` is aborted.\n\n  - `attempt`\n\n    Attempt number starting with 0.\n\n  - `reset`\n\n    Function that sets attempt number to -1 so that the next attempt will be\n    made without delay.\n\n- `RetryOptions.baseMs`\n\n  Starting delay before first retry attempt in milliseconds.\n\n  Defaults to 1000.\n\n  Example: if `baseMs` is 100, then retries will be attempted in 100ms, 200ms,\n  400ms etc (not counting jitter).\n\n- `RetryOptions.maxDelayMs`\n\n  Maximum delay between attempts in milliseconds.\n\n  Defaults to 30 seconds.\n\n  Example: if `baseMs` is 1000 and `maxDelayMs` is 3000, then retries will be\n  attempted in 1000ms, 2000ms, 3000ms, 3000ms etc (not counting jitter).\n\n- `RetryOptions.maxAttempts`\n\n  Maximum for the total number of attempts.\n\n  Defaults to `Infinity`.\n\n- `RetryOptions.onError`\n\n  Called after each failed attempt before setting delay timer.\n\n  Rethrow error from this callback to prevent further retries.\n\n### `proactiveRetry`\n\n```ts\nfunction proactiveRetry<T>(\n  signal: AbortSignal,\n  fn: (signal: AbortSignal, attempt: number) => Promise<T>,\n  options?: ProactiveRetryOptions,\n): Promise<T>;\n\ntype ProactiveRetryOptions = {\n  baseMs?: number;\n  maxAttempts?: number;\n  onError?: (error: unknown, attempt: number) => void;\n};\n```\n\nProactively retry a function with exponential backoff.\n\nAlso known as hedging.\n\nThe function will be called multiple times in parallel until it succeeds, in\nwhich case all the other calls will be aborted.\n\n- `fn`\n\n  A function that will be called multiple times in parallel until it succeeds.\n  It receives:\n\n  - `signal`\n\n    `AbortSignal` that is aborted when the signal passed to `retry` is aborted,\n    or when the function succeeds.\n\n  - `attempt`\n\n    Attempt number starting with 0.\n\n- `ProactiveRetryOptions.baseMs`\n\n  Base delay between attempts in milliseconds.\n\n  Defaults to 1000.\n\n  Example: if `baseMs` is 100, then retries will be attempted in 100ms, 200ms,\n  400ms etc (not counting jitter).\n\n- `ProactiveRetryOptions.maxAttempts`\n\n  Maximum for the total number of attempts.\n\n  Defaults to `Infinity`.\n\n- `ProactiveRetryOptions.onError`\n\n  Called after each failed attempt.\n\n  Rethrow error from this callback to prevent further retries.\n\n### `execute`\n\n```ts\nfunction execute<T>(\n  signal: AbortSignal,\n  executor: (\n    resolve: (value: T) => void,\n    reject: (reason?: any) => void,\n  ) => () => void | PromiseLike<void>,\n): Promise<T>;\n```\n\nSimilar to `new Promise(executor)`, but allows executor to return abort callback\nthat is called once `signal` is aborted.\n\nReturned promise rejects with `AbortError` once `signal` is aborted.\n\nCallback can return a promise, e.g. for doing any async cleanup. In this case,\nthe promise returned from `execute` rejects with `AbortError` after that promise\nfulfills.\n\n### `abortable`\n\n```ts\nfunction abortable<T>(signal: AbortSignal, promise: PromiseLike<T>): Promise<T>;\n```\n\nWrap a promise to reject with `AbortError` once `signal` is aborted.\n\nUseful to wrap non-abortable promises. Note that underlying process will NOT be\naborted.\n\n### `run`\n\n```ts\nfunction run(fn: (signal: AbortSignal) => Promise<void>): () => Promise<void>;\n```\n\nInvokes an abortable function with implicitly created `AbortSignal`.\n\nReturns a function that aborts that signal and waits until passed function\nfinishes.\n\nAny error other than `AbortError` thrown from passed function will result in\nunhandled promise rejection.\n\nExample:\n\n```ts\nconst stop = run(async signal => {\n  try {\n    while (true) {\n      await delay(signal, 1000);\n      console.log('tick');\n    }\n  } finally {\n    await doCleanup();\n  }\n});\n\n// abort and wait until cleanup is done\nawait stop();\n```\n\nThis function is also useful with React `useEffect` hook:\n\n```ts\n// make requests periodically while the component is mounted\nuseEffect(\n  () =>\n    run(async signal => {\n      while (true) {\n        await makeRequest(signal);\n        await delay(signal, 1000);\n      }\n    }),\n  [],\n);\n```\n\n### `AbortError`\n\n```ts\nclass AbortError extends Error\n```\n\nThrown when an abortable function was aborted.\n\n**Warning**: do not use `instanceof` with this class. Instead, use\n`isAbortError` function.\n\n### `isAbortError`\n\n```ts\nfunction isAbortError(error: unknown): boolean;\n```\n\nChecks whether given `error` is an `AbortError`.\n\n### `throwIfAborted`\n\n```ts\nfunction throwIfAborted(signal: AbortSignal): void;\n```\n\nIf `signal` is aborted, throws `AbortError`. Otherwise does nothing.\n\n### `rethrowAbortError`\n\n```ts\nfunction rethrowAbortError(error: unknown): void;\n```\n\nIf `error` is `AbortError`, throws it. Otherwise does nothing.\n\nUseful for `try/catch` blocks around abortable code:\n\n```ts\ntry {\n  await somethingAbortable(signal);\n} catch (err) {\n  rethrowAbortError(err);\n\n  // do normal error handling\n}\n```\n\n### `catchAbortError`\n\n```ts\nfunction catchAbortError(error: unknown): void;\n```\n\nIf `error` is `AbortError`, does nothing. Otherwise throws it.\n\nUseful for invoking top-level abortable functions:\n\n```ts\nsomethingAbortable(signal).catch(catchAbortError);\n```\n\nWithout `catchAbortError`, aborting would result in unhandled promise rejection.\n\n[npm-image]: https://badge.fury.io/js/abort-controller-x.svg\n[npm-url]: https://badge.fury.io/js/abort-controller-x\n","_attachments":{},"homepage":"https://github.com/deeplay-io/abort-controller-x#readme","bugs":{"url":"https://github.com/deeplay-io/abort-controller-x/issues"},"license":"MIT"}