1.0.2 • Published 3 years ago

relay-link-batch v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

Batch Link

Purpose

An Relay Link to allow batching of multiple operations into a single request. For example, the relay-link-batch-http uses this link to batch operations into a single http request.

Installation

npm install relay-link-batch --save

Usage

import { BatchLink } from "relay-link-batch";

const link = new BatchLink({
  batchHandler: (operations: Operation[], forward: NextLink) => Observable<FetchResult[]> | null
});

Options

Batch Link takes an object with three options on it to customize the behavior of the link. The only required option is the batchHandler function

namevaluedefaultrequired
batchIntervalnumber10false
batchMaxnumber0false
batchHandler(operations: Operation[], forward: NextLink) => Observable<FetchResult[]>nullNAtrue

Context

The Batch Link does not use the context for anything