Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

RxJS Release v2.2.19

Compare
Choose a tag to compare
@mattpodwysocki mattpodwysocki released this 06 Apr 01:01
· 1949 commits to master since this release

This is a bit of an update from v2.2.18 with a couple of changes including:

  • Rx.Observable.fromEvent Changes
  • Backpressure Changes

Note that there are no breaking changes in this release.

Rx.Observable.fromEvent Changes

RxJS at its core will now support a number of libraries to help developers be productive without having to bring in other library specific RxJS bindings such as RxJS-jQuery. It will now support the following libraries

  • jQuery
  • Zepto
  • AngularJS
  • Ember

RxJS will now shortcut to use native methods for jQuery, Zepto, Angular's jqLite, and Ember, thus giving you the same experience had you used the library directly. The only caveat is that this method does not support a selector string which jQuery, Zepto and Ember support.

Backpressure Changes

In previous releases, the mechanism to pause and resume on both the pausable and pausableBuffered methods was to use the Subject directly to pass in either true or false depending on whether you wanted to pause or resume. In this release, this has been simplified to be able to use pause and resume to make it much more intuitive.

var pauser = new Rx.Subject();

// Create pausable
var pausable = Rx.Observable.fromEvent(document, 'mousemove').pausable(pauser);
var subscription = pausable.subscribe(function (next) {
  // Do something with values
});

// Now pause/resume
// unpause
pausable.resume();

// Stop and resume every five seconds
// Note: can use the outside Subject still too, no breaking changes.
var shouldRun = true;
setInterval(function () {
  if (shouldRun = !shouldRun) {
    pausable.pause();
  } else {
    pausable.resume();
  }
}, 5000);

In addition, the requirement for an external Rx.Subject has been made optional, so that the subject can stay internal and therefore not shared.

// With no outside controller
var pausable = Rx.Observable.fromEvent(document, 'mousemove').pausable();
var subscription = pausable.subscribe(function (next) {
  // Do something with values
});