relay-link-batch

Relay Link that performs batching and operation on batched Operations

Usage no npm install needed!

<script type="module">
  import relayLinkBatch from 'https://cdn.skypack.dev/relay-link-batch';
</script>

README

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

name value default required
batchInterval number 10 false
batchMax number 0 false
batchHandler (operations: Operation[], forward: NextLink) => Observable<FetchResult[]> null NA

Context

The Batch Link does not use the context for anything