Skip to content

FuturableJavaScript's Promise and Fetch APIs

Supercharged with cancellation, delays, polling and more! ๐Ÿš€

Futurable

Quick Example โ€‹

typescript
import { Futurable } from '@ndriadev/futurable';

// Create a cancellable fetch request
const request = Futurable.fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => console.log(data));

// Cancel it anytime
request.cancel();

Why Futurable? โ€‹

JavaScript's native Promise API is powerful but lacks crucial features for modern applications:

  • โŒ No way to cancel pending promises
  • โŒ No built-in delay or sleep functionality
  • โŒ Fetch API requires complex AbortController setup
  • โŒ No polling mechanism out of the box

Futurable solves all of these problems with a clean, intuitive API that feels natural to use.

Browser & Node.js Support โ€‹

  • โœ… All modern browsers (Chrome, Firefox, Safari, Edge)
  • โœ… Node.js 14+ (Native Fetch API support in Node.js 17.5+)
  • โœ… TypeScript 4.5+
  • โœ… Works with React, Vue, Angular, and vanilla JavaScript

Installation โ€‹

bash
npm install @ndriadev/futurable
bash
yarn add @ndriadev/futurable
bash
pnpm add @ndriadev/futurable

License โ€‹

MIT ยฉ Andrea Cosentino

Released under the MIT License.