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

Commit 55702b2

Browse files
Closing Issue #541
1 parent 8364c13 commit 55702b2

30 files changed

+797
-412
lines changed

Gruntfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ var browsers = [{
103103
'src/core/perf/operators/fromarray.js',
104104
'src/core/linq/observable/generate.js',
105105
'src/core/linq/observable/of.js',
106+
'src/core/linq/observable/ofarraychanges.js',
107+
'src/core/linq/observable/ofobjectchanges.js',
106108
'src/core/linq/observable/never.js',
107109
'src/core/linq/observable/pairs.js',
108110
'src/core/linq/observable/range.js',

dist/rx.all.compat.js

Lines changed: 80 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,6 +2386,10 @@
23862386
__super__.call(this, subscribe);
23872387
}
23882388

2389+
ObservableBase.prototype.subscribeCore = function(observer) {
2390+
throw new Error('Not implemeneted');
2391+
}
2392+
23892393
return ObservableBase;
23902394

23912395
}(Observable));
@@ -4431,36 +4435,39 @@
44314435

44324436
}(ObservableBase));
44334437

4434-
var MapObserver = (function (__super__) {
4435-
inherits(MapObserver, __super__);
4438+
function MapObserver(observer, selector, source) {
4439+
this.observer = observer;
4440+
this.selector = selector;
4441+
this.source = source;
4442+
this.index = 0;
4443+
this.isStopped = false;
4444+
}
44364445

4437-
function MapObserver(observer, selector, source) {
4438-
this.observer = observer;
4439-
this.selector = selector;
4440-
this.source = source;
4441-
this.index = 0;
4442-
__super__.call(this);
4446+
MapObserver.prototype.onNext = function(x) {
4447+
if (this.isStopped) { return; }
4448+
try {
4449+
var result = this.selector(x, this.index++, this.source);
4450+
} catch(e) {
4451+
return this.observer.onError(e);
44434452
}
4444-
4445-
MapObserver.prototype.next = function(x) {
4446-
try {
4447-
var result = this.selector(x, this.index++, this.source);
4448-
} catch(e) {
4449-
return this.observer.onError(e);
4450-
}
4451-
this.observer.onNext(result);
4452-
};
4453-
4454-
MapObserver.prototype.error = function (e) {
4453+
this.observer.onNext(result);
4454+
};
4455+
MapObserver.prototype.onError = function (e) {
4456+
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
4457+
};
4458+
MapObserver.prototype.onCompleted = function () {
4459+
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
4460+
};
4461+
MapObserver.prototype.dispose = function() { this.isStopped = true; };
4462+
MapObserver.prototype.fail = function (e) {
4463+
if (!this.isStopped) {
4464+
this.isStopped = true;
44554465
this.observer.onError(e);
4456-
};
4457-
4458-
MapObserver.prototype.completed = function () {
4459-
this.observer.onCompleted();
4460-
};
4466+
return true;
4467+
}
44614468

4462-
return MapObserver;
4463-
}(AbstractObserver));
4469+
return false;
4470+
};
44644471

44654472
/**
44664473
* Projects each element of an observable sequence into a new form by incorporating the element's index.
@@ -4476,12 +4483,26 @@
44764483
};
44774484

44784485
/**
4479-
* Retrieves the value of a specified property from all elements in the Observable sequence.
4480-
* @param {String} prop The property to pluck.
4486+
* Retrieves the value of a specified nested property from all elements in
4487+
* the Observable sequence.
4488+
* @param {Arguments} arguments The nested properties to pluck.
44814489
* @returns {Observable} Returns a new Observable sequence of property values.
44824490
*/
4483-
observableProto.pluck = function (prop) {
4484-
return this.map(function (x) { return x[prop]; });
4491+
observableProto.pluck = function () {
4492+
var args = arguments, len = arguments.length;
4493+
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
4494+
return this.map(function (x) {
4495+
var currentProp = x;
4496+
for (var i = 0; i < len; i++) {
4497+
var p = currentProp[args[i]];
4498+
if (typeof p !== 'undefined') {
4499+
currentProp = p;
4500+
} else {
4501+
return undefined;
4502+
}
4503+
}
4504+
return currentProp;
4505+
});
44854506
};
44864507

44874508
function flatMap(source, selector, thisArg) {
@@ -4719,36 +4740,41 @@
47194740

47204741
}(ObservableBase));
47214742

4722-
var FilterObserver = (function (__super__) {
4723-
inherits(FilterObserver, __super__);
4743+
function FilterObserver(observer, predicate, source) {
4744+
this.observer = observer;
4745+
this.predicate = predicate;
4746+
this.source = source;
4747+
this.index = 0;
4748+
this.isStopped = false;
4749+
}
47244750

4725-
function FilterObserver(observer, predicate, source) {
4726-
this.observer = observer;
4727-
this.predicate = predicate;
4728-
this.source = source;
4729-
this.index = 0;
4730-
__super__.call(this);
4751+
FilterObserver.prototype.onNext = function(x) {
4752+
try {
4753+
var shouldYield = this.predicate(x, this.index++, this.source);
4754+
} catch(e) {
4755+
return this.observer.onError(e);
47314756
}
4757+
shouldYield && this.observer.onNext(x);
4758+
};
47324759

4733-
FilterObserver.prototype.next = function(x) {
4734-
try {
4735-
var shouldYield = this.predicate(x, this.index++, this.source);
4736-
} catch(e) {
4737-
return this.observer.onError(e);
4738-
}
4739-
shouldYield && this.observer.onNext(x);
4740-
};
4741-
4742-
FilterObserver.prototype.error = function (e) {
4760+
FilterObserver.prototype.onError = function (e) {
4761+
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
4762+
};
4763+
FilterObserver.prototype.onCompleted = function () {
4764+
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
4765+
};
4766+
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
4767+
FilterObserver.prototype.fail = function (e) {
4768+
if (!this.isStopped) {
4769+
this.isStopped = true;
47434770
this.observer.onError(e);
4744-
};
4771+
return true;
4772+
}
4773+
4774+
return false;
4775+
};
47454776

4746-
FilterObserver.prototype.completed = function () {
4747-
this.observer.onCompleted();
4748-
};
47494777

4750-
return FilterObserver;
4751-
}(AbstractObserver));
47524778

47534779
/**
47544780
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.

dist/rx.all.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.compat.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)