Skip to content

Commit

Permalink
chore(package): release new version
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Jul 8, 2016
1 parent e55da7a commit c0071c6
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 22 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="5.1.4"></a>
## [5.1.4](https://github.com/staltz/xstream/compare/v5.1.3...v5.1.4) (2016-07-08)


### Bug Fixes

* **MemoryStream:** fix teardown of MemoryStream to forget past executions ([6bdf596](https://github.com/staltz/xstream/commit/6bdf596)), closes [#71](https://github.com/staltz/xstream/issues/71)



<a name="5.1.3"></a>
## [5.1.3](https://github.com/staltz/xstream/compare/v5.1.2...v5.1.3) (2016-07-06)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ XStream has four fundamental types: Stream, Listener, Producer, and MemoryStream
A Stream is an **event emitter** with multiple Listeners. When an event happens on the
Stream, it is broadcast to all its Listeners at the same time.

Streams have methods attached to them called *operators*, such as `map`, `filter`, `fold`, `take`, etc. When called, an operator creates and returns another Stream. The returned Stream is actually a Listener of the source Stream (I forgot to tell you that Streams may be Listeners, too). So once the source Stream broadcasts an event, the event will pass through the operator logic and the returned Stream may perhaps broadcast its own event based on the source one.
Streams have methods attached to them called *operators*, such as `map`, `filter`, `fold`, `take`, etc. When called, an operator creates and returns another Stream. Once the first Stream broadcasts an event, the event will pass through the operator logic and the output Stream may perhaps broadcast its own event based on the source one.

You can also trigger an event to happen on a Stream with the `shamefullySend*` methods. But you don't want to do that. Really, avoid doing that because it's not the reactive way and you'll be missing the point of this library. Ok?

Expand Down
48 changes: 29 additions & 19 deletions dist/xstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,22 +893,11 @@ var Stream = (function () {
this._err = null;
this._ils = [];
};

Stream.prototype.addListener = function (listener) {
if (typeof listener.next !== 'function'
|| typeof listener.error !== 'function'
|| typeof listener.complete !== 'function') {
throw new Error('stream.addListener() requires all three next, error, ' +
'and complete functions.');
}
listener._n = listener.next;
listener._e = listener.error;
listener._c = listener.complete;
this._add(listener);
};

Stream.prototype.removeListener = function (listener) {
this._remove(listener);
Stream.prototype._lateStop = function () {


this._prod._stop();
this._err = null;
};
Stream.prototype._add = function (il) {
var ta = this._target;
Expand All @@ -927,17 +916,17 @@ var Stream = (function () {
}
};
Stream.prototype._remove = function (il) {
var _this = this;
var ta = this._target;
if (ta)
return ta._remove(il);
var a = this._ils;
var i = a.indexOf(il);
if (i > -1) {
a.splice(i, 1);
var p_1 = this._prod;
if (p_1 && a.length <= 0) {
if (this._prod && a.length <= 0) {
this._err = null;
this._stopID = setTimeout(function () { return p_1._stop(); });
this._stopID = setTimeout(function () { return _this._lateStop(); });
}
else if (a.length === 1) {
this._pruneCycles();
Expand Down Expand Up @@ -983,6 +972,23 @@ var Stream = (function () {
return this instanceof MemoryStream ? MemoryStream : Stream;
};

Stream.prototype.addListener = function (listener) {
if (typeof listener.next !== 'function'
|| typeof listener.error !== 'function'
|| typeof listener.complete !== 'function') {
throw new Error('stream.addListener() requires all three next, error, ' +
'and complete functions.');
}
listener._n = listener.next;
listener._e = listener.error;
listener._c = listener.complete;
this._add(listener);
};

Stream.prototype.removeListener = function (listener) {
this._remove(listener);
};

Stream.create = function (producer) {
if (producer) {
if (typeof producer.start !== 'function'
Expand Down Expand Up @@ -1179,6 +1185,10 @@ var MemoryStream = (function (_super) {
}
_super.prototype._add.call(this, il);
};
MemoryStream.prototype._lateStop = function () {
this._has = false;
_super.prototype._lateStop.call(this);
};
MemoryStream.prototype._x = function () {
this._has = false;
_super.prototype._x.call(this);
Expand Down
Loading

0 comments on commit c0071c6

Please sign in to comment.