Skip to content

Releases: TENSIILE/saborter-react

v2.0.0 (March 4th, 2026)

04 Mar 17:36

Choose a tag to compare

What's Changed

💥 Breaking Changes

  • Increases the saborter version to 2 majors

✨ New Features

  • useReusableAborter hook - hook wrapper over the ReusableAborter class

🎯 Usage Example

const aborter = new useReusableAborter();

// Get the current signal
const signal = aborter.signal;

// Attach listeners
signal.addEventListener('abort', () => console.log('Listener 1'));
signal.addEventListener('abort', () => console.log('Listener 2'), { once: true }); // won't be recovered

// Set onabort handler
signal.onabort = () => console.log('Onabort handler');

// First abort
aborter.abort('First reason');
// Output:
// Listener 1
// Listener 2 (once)
// Onabort handler

// The signal is now a fresh one, but the non‑once listeners and onabort are reattached
signal.addEventListener('abort', () => console.log('Listener 3')); // new listener, will survive next abort

// Second abort
aborter.abort('Second reason');
// Output:
// Listener 1
// Onabort handler
// Listener 3

📦 Distribution

  • Available via npm: npm install @saborter/react
  • Available via yarn: yarn add @saborter/react

Full Changelog: v1.0.0...v2.0.0

v1.0.0 (February 4th, 2026)

24 Feb 13:48

Choose a tag to compare

What's Changed | 🎉 Initial Release of @saborter/react

✨ New Features

Core Functionality

  • useAborter hook - Saborter instance wrapped React API

📖 Possibilities

  • The aborter field always has the same reference to the Aborter instance.
  • Automatically abort the request when the component is unmounted.
  • Automatically unsubscribe from all listeners when the component is unmounted.

🎯 Usage Example

import { useAborter } from '@saborter/react';

const Component = () => {
  // Create an Aborter instance via the hook
  const { aborter } = useAborter();

  // Use for the request
  const fetchData = async () => {
    try {
      const data = await aborter.try((signal) => fetch('/api/data', { signal }));
      console.log('Data received:', data);
    } catch (error) {
      console.error('Request error:', error);
    }
  };
};

📦 Distribution

  • Available via npm: npm install @saborter/react
  • Available via yarn: yarn add @saborter/react