Get started with rxjs-jquery CDN

Apache-2.0 licensed

RxJS-jQuery is a library that allows integrating jQuery events with RxJS observables.

Tags:
  • Reactive
  • LINQ
  • Collections
  • jQuery
  • RxJS
  • Rx

Stable version

Copied!

How to start using rxjs-jquery CDN


// Import required libraries
import { fromEvent, interval, merge, Observable } from 'rxjs';
import $ from 'jquery';

// Use jQuery to select an element and observe its click events
const button = $('#myButton')[0];
const clicks = fromEvent(button, 'click');

// Use RxJS to merge the click events with a timer that emits every second
const source = merge(clicks, interval(1000));

// Use RxJS operators to map and subscribe to the observable
source.pipe(
  map(event => {
    console.log('Button clicked:', event.type);
    return event.type;
  })
)
.subscribe(
  data => console.log('Next:', data),
  error => console.error('Error:', error),
  () => console.log('Completed')
);
Copied!
Copied!
Copied!

All versions