You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any chance anyone remembers behaviors/bugs in 0.10.x that cause stream.Readable to start emitting data as soon as .on("data", fn) is attached but before .on("end", fn)?
varstream=xx.createStream();stream.on("data",function(){console.log("data emitted");});stream.on("end",function(){console.log("end emitted");});// won't be called unless moved before .on("data")
This behavior seems unique to 0.10 (not 0.12 or later) and unique to stream.Readable (not stream.Stream). I'm not sure if my usage of stream.Readable is causing this (e.g. https://github.com/Automattic/node-canvas/pull/740/files#diff-45eee70dc7ffb2bde8f118a35949d995). I think it can be fixed by wrapping the emitter in process.nextTick, but I would like to make sure that's not a fix for something I'm doing wrong. Thanks!
The text was updated successfully, but these errors were encountered:
The other semantic change is that adding a readable event handler will not cause readable to be emitted until nextTick
Relevant diff:
nodejs/node-v0.x-archive@0f8de5e#diff-ba6a0df0f5212f5cba5ca5179e209a17L681
Notice .resume calls through a nextTick, whereas the removed emitDataEvents looks like it plowed straight through.
(Context: Automattic/node-canvas#740 (comment))
Any chance anyone remembers behaviors/bugs in 0.10.x that cause
stream.Readable
to start emitting data as soon as.on("data", fn)
is attached but before.on("end", fn)
?This behavior seems unique to 0.10 (not 0.12 or later) and unique to
stream.Readable
(notstream.Stream
). I'm not sure if my usage ofstream.Readable
is causing this (e.g. https://github.com/Automattic/node-canvas/pull/740/files#diff-45eee70dc7ffb2bde8f118a35949d995). I think it can be fixed by wrapping the emitter inprocess.nextTick
, but I would like to make sure that's not a fix for something I'm doing wrong. Thanks!The text was updated successfully, but these errors were encountered: