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.