First, thanks for pull-streams— truly a treat :)
I attempted to implement a deferred source using pull-many. It looks like this:
function defer () {
const deferred = many()
return Object.assign(deferred, {
resolve (stream) {
deferred.add(stream)
deferred.cap()
}
})
}
This works, however I find that the resolved stream is eagerly pulled even if there's no sink. Here's an example:
const deferred = defer()
deferred.resolve(pull(pull.once('x'), pull.through(console.log)))
// I would expect no output since there is no sink, but instead 'x' is logged
Does this behavior seem intentional or might there be something to dig into here? My workaround is simply to use pull-defer, which preserves laziness in the way I originally expected. If you believe there's an issue here, I would be happy to look into contributing a fix.