async-retry-decorator
TypeScript icon, indicating that this package has built-in type declarations

1.10.1 • Public • Published

async-retry-decorator

Typescript decorator base on async-retry

How to install

$ yarn add async-retry-decorator
$ npm install --save async-retry-decorator

Example

  import { retry } from 'async-retry-decorator';

  class Clazz {
    @retry({
      retries: 5,
      onRetry: (error, attempt) => {
        console.log(`Retry (${attempt}) on error`, error.message);
      },
    })
    public async method(): Promise<any> {
      // [...]
    }
  }

You can use all options available in async-retry directly in the decorator options

Package Sidebar

Install

npm i async-retry-decorator

Weekly Downloads

457

Version

1.10.1

License

ISC

Unpacked Size

5.01 kB

Total Files

7

Last publish

Collaborators

  • neru