ensure upstream does not affect ended stream
This commit is contained in:
parent
f5bb364b22
commit
a875f7e162
2 changed files with 14 additions and 0 deletions
|
|
@ -132,6 +132,10 @@ function registerDependency(stream, parents) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function unregisterStream(stream) {
|
function unregisterStream(stream) {
|
||||||
|
for (var i = 0; i < stream._state.parents.length; i++) {
|
||||||
|
var parent = stream._state.parents[i]
|
||||||
|
delete parent._state.deps[stream._state.id]
|
||||||
|
}
|
||||||
for (var id in stream._state.deps) {
|
for (var id in stream._state.deps) {
|
||||||
var dependent = stream._state.deps[id]
|
var dependent = stream._state.deps[id]
|
||||||
var index = dependent._state.parents.indexOf(stream)
|
var index = dependent._state.parents.indexOf(stream)
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,16 @@ o.spec("stream", function() {
|
||||||
|
|
||||||
o(doubled()).equals(undefined)
|
o(doubled()).equals(undefined)
|
||||||
})
|
})
|
||||||
|
o("upstream does not affect ended stream", function() {
|
||||||
|
var stream = Stream.stream(2)
|
||||||
|
var doubled = Stream.combine(function(stream) {return stream() * 2}, [stream])
|
||||||
|
|
||||||
|
doubled.end(true)
|
||||||
|
|
||||||
|
stream(4)
|
||||||
|
|
||||||
|
o(doubled()).equals(4)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
o.spec("error", function() {
|
o.spec("error", function() {
|
||||||
o("error() works", function() {
|
o("error() works", function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue