0.1.1 • Published 2 years ago

segmented v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.

0.1.1

2 years ago

0.1.0

2 years ago

0.0.0

2 years ago