segmented

0.1.1 • Public • Published

NPM version Repository package.json version MIT License Discord

Segmented

Segmented async operations to abort.

Installation

npm install segmented

Usage

import {segment} from 'segmented';

const segmented = segment(() => fetch('https://example.com'))
  .then(response => response.json())
  .then(console.log);

segmented.abort();

The segmented object returned is also an callable equivalent to abort() method:

import {segment} from 'segmented';

useEffect(
  () =>
    segment(() => fetch('https://example.com'))
      .then(response => response.json())
      .then(console.log),
  [],
);

License

MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i segmented

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

9.66 kB

Total Files

7

Last publish

Collaborators

  • vilicvane