github Reactive-Extensions/RxJS v2.2.18
RxJS Release v2.2.18

latest releases: v4.1.0, v4.0.8, v4.0.7...
10 years ago

Update from RxJS v2.2.17 to include the following changes.

Helper Functions

In order to facilitate people using default parameters, RxJS exports helper functions in the Rx.helpers object including:

  • noop - No operation
  • identity - Passthrough function which returns the parameter value.
  • defaultNow - Default function for getting the current time.
  • defaultComparer - Default comparer which uses the interval Rx.internals.isEqual function.
  • defaultSubComparer - Default comparer for using comparisons of greater than, less than or equal to.
  • defaultKeySerializer Default key serializer function which calls .toString by default.
  • defaultError - Throws the given error
  • isPromise - Used to detect whether the given object is a Promise.
  • asArray- Converts the arguments of the function into an array.
  • not - Returns the opposite of the current function's return value.

More Promises Support

In addition to the previous support for Promises from the previous release for flatMap/selectMany,we have now extended it to the following:

  • Rx.Observable.catch
  • Rx.Observable.concat
  • Rx.Observable.defer

An example for defer would look like the following:

// Concat on Promises to execute sequentially
var promises = [ur1, url2, url3].map(function (url) {
  // Ensure we don't fire each until it is subscribed
  return Rx.Observable.defer(function () { 
    return getJSON(url); 
  });  
});

var sources = Rx.Observable.concat(promises).toArray();
sources.subscribe(function (results) {
  // Get all the results as an array
});

In addition, this works with concat such as the following:

/* Concat as arguments */
var sources = Rx.Observable.concat(promise1, promise2, promise3);

/* Concat as an array */
var sources = Rx.Observable.concat([promise1, promise2, promise3]);

/* Concat on an Observable */
var newSource = source.concat(promise1);

In addition, this works nicely with catch as well.

/* Catch as arguments */
var sources = Rx.Observable.catch(promise1, promise2, promise3);

/* Catch as an array */
var sources = Rx.Observable.catch([promise1, promise2, promise3]);

/* Catch on an Observable */
var newSource = source.catch(promise1);

As time goes on, we'll also be looking at other areas for support for promises within RxJS.

Don't miss a new RxJS release

NewReleases is sending notifications on new releases.