JSPM

  • Created
  • Published
  • Downloads 73374
  • Score
    100M100P100Q160502F
  • License MIT

Retry Apollo Link for GraphQL Network Stack

Package Exports

  • apollo-link-retry

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (apollo-link-retry) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Retry Link

Purpose

An Apollo Link to allow multiple attempts when an operation has failed. One such use case is to try a request while a network connection is offline and retry until it comes back online. Retry's can vary based on operation through the configuration of the link.

Installation

npm install apollo-link-retry --save

To use this package in a web browser or mobile app, you'll need a build system capable of loading NPM packages on the client. Some common choices include Browserify, Webpack, and Meteor +1.3.

Usage

import RetryLink from "apollo-link-retry";

const link = new RetryLink();

Options

Retry Link takes an object with three options on it to customize the behavoir of the link.

name value default required
max number or Operation => number 10 false
delay number or Operation => number 300 false
interval (delay: number, count: number) => number delay => delay false
import RetryLink from "apollo-link-retry"

const max = (operation) => operation.getContext().max
const delay = 5000;
const interval = (delay, count) => {
  if (count > 5) return 10,000;
  return delay;
}

const link = new RetryLink({
  max,
  delay,
  interval
});

Context

The Retry Link does not use the context for anything