Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

abort-controller-x-rxjs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abort-controller-x-rxjs

Abortable helpers for RxJS


Version published
Weekly downloads
413
decreased by-21.63%
Maintainers
1
Weekly downloads
 
Created
Source

abort-controller-x-rxjs npm version

Abortable helpers for RxJS.

This is a companion package of abort-controller-x.

Installation

yarn add abort-controller-x-rxjs

API

defer

function defer<R extends ObservableInput<any> | void>(
  observableFactory: (signal: AbortSignal) => R,
): Observable<ObservedValueOf<R>>;

Like original defer from RxJS, but aborts passed function when unsubscribed.

firstValueFrom

function firstValueFrom<T, D>(
  signal: AbortSignal,
  source: Observable<T>,
  config: FirstValueFromConfig<D>,
): Promise<T | D>;
function firstValueFrom<T>(
  signal: AbortSignal,
  source: Observable<T>,
): Promise<T>;

interface FirstValueFromConfig<T> {
  defaultValue: T;
}

Like original firstValueFrom from RxJS, but accepts AbortSignal. When that signal is aborted, unsubscribes from the observable and throws AbortError.

lastValueFrom

function lastValueFrom<T, D>(
  signal: AbortSignal,
  source: Observable<T>,
  config: LastValueFromConfig<D>,
): Promise<T | D>;
function lastValueFrom<T>(
  signal: AbortSignal,
  source: Observable<T>,
): Promise<T>;

interface LastValueFromConfig<T> {
  defaultValue: T;
}

Like original lastValueFrom from RxJS, but accepts AbortSignal. When that signal is aborted, unsubscribes from the observable and throws AbortError.

fromAsyncGenerator

function fromAsyncGenerator<T>(
  fn: (signal: AbortSignal) => AsyncIterable<T>,
): Observable<T>;

Turns abortable async generator to observable.

Keywords

FAQs

Package last updated on 12 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc