-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move internal handlers to promises, add finished #41
base: master
Are you sure you want to change the base?
Conversation
@@ -317,7 +321,9 @@ class ReadableState { | |||
|
|||
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === 0) { | |||
stream._duplexState |= READ_ACTIVE_AND_SYNC_AND_NEEDS_PUSH | |||
stream._read(this.afterRead) | |||
const p = stream._read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callPromise(this, stream.read(), this.afterRead, this.afterReadError)
?
@@ -165,7 +166,9 @@ class WritableState { | |||
while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED) { | |||
const data = this.shift() | |||
stream._duplexState |= WRITE_ACTIVE_AND_SYNC | |||
stream._write(data, this.afterWrite) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callPromise(this, stream._write(data), this.afterWrite, this.afterWriteError)
?
@@ -890,6 +914,37 @@ function pipelinePromise (...streams) { | |||
}) | |||
} | |||
|
|||
function finished (stream) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be in a different PR? Seems to be usable immediately?
wip (will be a major bump if it lands)
moves ._write, ._read, ._final etc to promises instead of cbs.
does some tricks to avoid ticks when streams are sync to get that perf :)
missing test migration and transform streams still