In the emitter section, it explains that the emitter's emit method(s) are autobound to the instance so they can be passed in. Is it possible to have a stream's methods bound to its instance as well?
But the plug call fails because this._add does not exist because the this isn't bound correctly. I'm doing forEach(stream.plug.bind(stream)) for now, but that always feels a little ugly.
In the emitter section, it explains that the emitter's
emit
method(s) are autobound to the instance so they can be passed in. Is it possible to have a stream's methods bound to its instance as well?In my case, I'm trying to do something like this:
But the
plug
call fails becausethis._add
does not exist because thethis
isn't bound correctly. I'm doingforEach(stream.plug.bind(stream))
for now, but that always feels a little ugly.Thoughts?