Skip to content
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

Do not override the destroy method, use _destroy instead #135

Merged
merged 1 commit into from
Oct 27, 2017

Conversation

lpinca
Copy link
Contributor

@lpinca lpinca commented Oct 19, 2017

transform.destroy() is now available in readable-stream, so I think it makes sense to use it properly.

if (this._destroyed) return
this._destroyed = true

proxy._destroy = function(err, cb) {
Copy link
Contributor Author

@lpinca lpinca Oct 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the default implementation with

this.push(null)
this.end()

is probably better but I didn't change it as there might be something I'm missing here.

@@ -155,7 +150,7 @@ function WebSocketStream(target, protocols, options) {

function onmessage(event) {
var data = event.data
if (data instanceof ArrayBuffer) data = Buffer.from(new Uint8Array(data))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unrelated and not needed but there is no need to instantiate a new Uint8Array. You can use the ArrayBuffer directly.

I can revert this change or move it to its own commit/PR if wanted.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need.

@mcollina mcollina merged commit a6a7275 into max-mapper:master Oct 27, 2017
@lpinca lpinca deleted the use/_destroy branch October 27, 2017 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants