Skip to content

Commit

Permalink
v2.3.22
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeseno committed Dec 11, 2014
1 parent 19da2b8 commit 48bb036
Show file tree
Hide file tree
Showing 15 changed files with 919 additions and 731 deletions.
2 changes: 1 addition & 1 deletion lib/rxjs/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Rxjs
module Rails
VERSION = "2.3.20"
VERSION = "2.3.22"
end
end

260 changes: 117 additions & 143 deletions vendor/assets/javascripts/rx.all.compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@
}
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];

console.log(rFileName, rStartingLine, rEndingLine);

return fileName === rFileName &&
lineNumber >= rStartingLine &&
lineNumber <= rEndingLine;
Expand Down Expand Up @@ -211,6 +209,14 @@
stringProto = String.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;

// Fix for Tessel
if (!propertyIsEnumerable) {
propertyIsEnumerable = objectProto.propertyIsEnumerable = function (key) {
for (var k in this) { if (k === key) { return true; } }
return false;
};
}

try {
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
Expand Down Expand Up @@ -2191,16 +2197,18 @@ if (!Array.prototype.forEach) {

var self = this;
this._subscribe = function (observer) {
var oldOnError = observer.onError.bind(observer);

observer.onError = function (err) {
makeStackTraceLong(self, err);
observer.onError(err);
makeStackTraceLong(err, self);
oldOnError(err);
};

subscribe(observer);
return subscribe(observer);
};
} else {
this._subscribe = subscribe;
}

this._subscribe = subscribe;
}

observableProto = Observable.prototype;
Expand Down Expand Up @@ -4399,7 +4407,7 @@ if (!Array.prototype.forEach) {
return source.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
shouldRun = predicate.call(thisArg, value, count++, source);
} catch (e) {
observer.onError(e);
return;
Expand Down Expand Up @@ -5689,9 +5697,9 @@ if (!Array.prototype.forEach) {
return observableFromPromise(promise);
}

var PausableObservable = (function (_super) {
var PausableObservable = (function (__super__) {

inherits(PausableObservable, _super);
inherits(PausableObservable, __super__);

function subscribe(observer) {
var conn = this.source.publish(),
Expand Down Expand Up @@ -5720,7 +5728,7 @@ if (!Array.prototype.forEach) {
this.pauser = this.controller;
}

_super.call(this, subscribe);
__super__.call(this, subscribe, source);
}

PausableObservable.prototype.pause = function () {
Expand Down Expand Up @@ -5804,7 +5812,7 @@ if (!Array.prototype.forEach) {
next(true, 1);
})
);
});
}, source);
}

var PausableBufferedObservable = (function (__super__) {
Expand Down Expand Up @@ -5869,7 +5877,7 @@ if (!Array.prototype.forEach) {
this.pauser = this.controller;
}

__super__.call(this, subscribe);
__super__.call(this, subscribe, source);
}

PausableBufferedObservable.prototype.pause = function () {
Expand Down Expand Up @@ -5897,29 +5905,16 @@ if (!Array.prototype.forEach) {
return new PausableBufferedObservable(this, subject);
};

/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};

var ControlledObservable = (function (_super) {
var ControlledObservable = (function (__super__) {

inherits(ControlledObservable, _super);
inherits(ControlledObservable, __super__);

function subscribe (observer) {
return this.source.subscribe(observer);
}

function ControlledObservable (source, enableQueue) {
_super.call(this, subscribe);
__super__.call(this, subscribe, source);
this.subject = new ControlledSubject(enableQueue);
this.source = source.multicast(this.subject).refCount();
}
Expand All @@ -5933,132 +5928,111 @@ if (!Array.prototype.forEach) {

}(Observable));

var ControlledSubject = Rx.ControlledSubject = (function (_super) {
var ControlledSubject = (function (__super__) {

function subscribe (observer) {
return this.subject.subscribe(observer);
}

inherits(ControlledSubject, _super);
function subscribe (observer) {
return this.subject.subscribe(observer);
}

function ControlledSubject(enableQueue) {
if (enableQueue == null) {
enableQueue = true;
}
inherits(ControlledSubject, __super__);

_super.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.controlledDisposable = disposableEmpty;
}

addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
checkDisposed.call(this);
this.hasCompleted = true;
function ControlledSubject(enableQueue) {
enableQueue == null && (enableQueue = true);

if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
}
},
onError: function (error) {
checkDisposed.call(this);
this.hasFailed = true;
this.error = error;
__super__.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.controlledDisposable = disposableEmpty;
}

if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
}
},
onNext: function (value) {
checkDisposed.call(this);
var hasRequested = false;
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
this.hasCompleted = true;
(!this.enableQueue || this.queue.length === 0) && this.subject.onCompleted();
},
onError: function (error) {
this.hasFailed = true;
this.error = error;
(!this.enableQueue || this.queue.length === 0) && this.subject.onError(error);
},
onNext: function (value) {
var hasRequested = false;

if (this.requestedCount === 0) {
if (this.enableQueue) {
this.queue.push(value);
}
} else {
if (this.requestedCount !== -1) {
if (this.requestedCount-- === 0) {
this.disposeCurrentRequest();
}
}
hasRequested = true;
}
if (this.requestedCount === 0) {
this.enableQueue && this.queue.push(value);
} else {
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
hasRequested = true;
}
hasRequested && this.subject.onNext(value);
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
while (this.queue.length >= numberOfItems && numberOfItems > 0) {
this.subject.onNext(this.queue.shift());
numberOfItems--;
}

if (hasRequested) {
this.subject.onNext(value);
}
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
//console.log('queue length', this.queue.length);

while (this.queue.length >= numberOfItems && numberOfItems > 0) {
//console.log('number of items', numberOfItems);
this.subject.onNext(this.queue.shift());
numberOfItems--;
}
return this.queue.length !== 0 ?
{ numberOfItems: numberOfItems, returnValue: true } :
{ numberOfItems: numberOfItems, returnValue: false };
}

if (this.queue.length !== 0) {
return { numberOfItems: numberOfItems, returnValue: true };
} else {
return { numberOfItems: numberOfItems, returnValue: false };
}
}
if (this.hasFailed) {
this.subject.onError(this.error);
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
} else if (this.hasCompleted) {
this.subject.onCompleted();
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
}

if (this.hasFailed) {
this.subject.onError(this.error);
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
} else if (this.hasCompleted) {
this.subject.onCompleted();
this.controlledDisposable.dispose();
this.controlledDisposable = disposableEmpty;
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
this.disposeCurrentRequest();
var self = this, r = this._processRequest(number);

var number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});

return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
checkDisposed.call(this);
this.disposeCurrentRequest();
var self = this,
r = this._processRequest(number);

number = r.numberOfItems;
if (!r.returnValue) {
this.requestedCount = number;
this.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});

return this.requestedDisposable
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
},
return this.requestedDisposable
} else {
return disposableEmpty;
}
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
}
});

dispose: function () {
this.isDisposed = true;
this.error = null;
this.subject.dispose();
this.requestedDisposable.dispose();
}
});
return ControlledSubject;
}(Observable));

return ControlledSubject;
}(Observable));
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.controlled = function (enableQueue) {
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue);
};

/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
Expand Down
4 changes: 2 additions & 2 deletions vendor/assets/javascripts/rx.all.compat.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 48bb036

Please sign in to comment.