Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-retry.ts

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-retry.ts

async await version of co-retry.js(https://www.npmjs.com/package/co-retry.js), which can be used in both TypeScript and JavaScript.

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-84.21%
Maintainers
1
Weekly downloads
 
Created
Source

async-retry.ts

async await version of co-retry.js, which can be used in both TypeScript and JavaScript.

npm download NPM version Build Status Dependencies Status Coverage Status code style: prettier

安装

npm install async-retry.ts --save

用法

简单示例:

非 async 版:
import Action from 'async-retry.ts'

const action = () => {}
const handlers = [
  {
    error: 'error1',
    handler: yourHandler1,
  },
  {
    error: 'error2',
    handler: yourHandler2,
  },
]

Action.retry(action, 3, handlers)
async 版:
import Action from 'async-retry.ts'

const action = async()=>{}
const handlers = [{
  error: 'error1',
  handler: async yourHandler1()=>{}
}, {
  error: 'error2',
  handler: async yourHandler2()=>{}
}]

Action.retryAsync(action, 3, handlers)

完整示例:

开发

  1. 修改代码后跑

    npm test
    

    确保测试通过。

  2. git commit

  3. npm version patch/minor/major

  4. npm publish

FAQs

Package last updated on 25 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc