attempt:一个JavaScript库,可以更轻松地重试返回Promise的函数

时间:2021-05-02 16:00:45
【文件属性】:
文件名称:attempt:一个JavaScript库,可以更轻松地重试返回Promise的函数
文件大小:56KB
文件格式:ZIP
更新时间:2021-05-02 16:00:45
nodejs javascript typescript async promise 试图 这个库出口retry(...)可以用来调用一个函数,返回一个函数Promise多次,直到返回Promise达到解决或尝试的最大数量。 每次尝试之间的延迟是可配置的,并允许多种重试策略。 支持以下功能: 固定尝试之间的延迟 指数退避 带 指数退避 中止提前重试 由于超时中止 每次尝试的错误处理程序 安装 使用NPM: npm i @lifeomic/attempt 使用纱线: yarn add @lifeomic/attempt 用法 Node.js / CommonJS: const retry = require ( '@lifeomic/attempt' ) . retry ; ES6 / TypeScript import { retry } from '@lifeomic/attempt' ; try { const result = await r
【文件预览】:
attempt-master
----.gitignore(559B)
----tsconfig.json(586B)
----README.md(9KB)
----tsconfig-src-cjs.json(152B)
----.github()
--------workflows()
----test()
--------index.test.ts(13KB)
----tsconfig-src-esnext.json(157B)
----LICENSE(1KB)
----tsconfig-test.json(214B)
----package.json(2KB)
----tslint.json(46B)
----src()
--------index.ts(6KB)
----.babelrc(101B)
----tools()
--------bin()
--------build-util.js(2KB)
----.travis.yml(205B)
----.editorconfig(146B)
----yarn.lock(147KB)
----tsconfig-src-es6.json(151B)

网友评论