Closed boneskull closed 8 years ago
ok, it appears that fromEvents()
will unsubscribe upon deactivation. But I'm having a tough time understanding what deactivation looks like.
Yeah, you don't have to end each stream in order for it to be garbage collected.
var foo = Kefir.fromEvents(target, 'foo')
foo.onValue(fn)
// now if we want to dispose all resources, all we need to do is:
foo.offValue(fn)
foo = null
But I'm having a tough time understanding what deactivation looks like.
Did you read this section in the docs? http://rpominov.github.io/kefir/#active-state
@rpominov Yes...many times, unfortunately. Perhaps that section needs more clarification. I get it now, thanks.
(Sorry for spamming with questions)
I have a stream created via
fromEvents()
which will at some point no longer be useful. I'd like to clean it up. How can I cause this stream to end?stream._emit('end')
exists, but this is obviously not a public API.