Created
January 28, 2015 01:05
-
-
Save mattpodwysocki/da9d9f956a004a7019ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element. | |
* This can be in the form of an argument list of observables or an array. | |
* | |
* @example | |
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; }); | |
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; }); | |
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function. | |
*/ | |
observableProto.combineLatest = function () { | |
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); } | |
if (Array.isArray(args[0])) { | |
args[0].unshift(this); | |
} else { | |
args.unshift(this); | |
} | |
return combineLatest.apply(this, args); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment