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

rxjs-exhaustmap-with-trailing

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxjs-exhaustmap-with-trailing

A variant of RxJS exhaustMap that includes the trailing value emitted from the source observable while waiting for the inner observable to complete

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
127K
increased by0.97%
Maintainers
1
Weekly downloads
 
Created
Source

rxjs-exhaustmap-with-trailing

A variant of RxJS exhaustMap that includes trailing emissions from the source observable.

Marble Diagram

Just like the exhaustMap() RxJS operator, exhaustMapWithTrailing() will ignore all emissions from source observable as long as the projected observable is pending, but in addition it will include the last emission received from the source observable before the projected observable completed. Think of it as a combination of exhaustMap() and debounce().

Usage

import {exhaustMapWithTrailing} from "rxjs-exhaustmap-with-trailing"
import {delay} from "rxjs/operators"
import {fromEvent, of} from "rxjs"

const clicks = fromEvent(document, "click")

const result = clicks.pipe(
  exhaustMapWithTrailing((value) => of(value).pipe(delay(1000)))
)
result.subscribe((event) =>
  console.log("result: %d, %d", event.clientX, event.clientY)
)

Open CodeSandbox

API

exhaustMapWithTrailing

exhaustMapWithTrailing<T, R>(project: (value: T, index: number) => ObservableInput<R>): OperatorFunction<T, R>;

exhaustMapToWithTrailing

exhaustMapToWithTrailing<T, R>(innerObservable: Observable<R>): OperatorFunction<T, R>;

Credits

This is a packaged and unit tested version of the implementation posted by @aaronjensen here: https://github.com/ReactiveX/rxjs/issues/5004

Keywords

FAQs

Package last updated on 20 Sep 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