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

socket.constructor.name returns Emitter #33

Open
mattkrick opened this issue Nov 24, 2015 · 0 comments
Open

socket.constructor.name returns Emitter #33

mattkrick opened this issue Nov 24, 2015 · 0 comments
Assignees

Comments

@mattkrick
Copy link
Contributor

Object.create doesn't assign anything to the prototype. There are 2 workarounds for this:
Option 1 use new (technically, this is faster since V8 optimizes for it, but used so infrequently it really doesn't matter)
Option 2 SCSocket.prototype.constructor = SCSocket + don't use anonymous function for creators (eg var SCSocket = function SCSocket(...`

use case:
user passes in either a socket or a channel into a function. If socket do x, if channel, do y.

@jondubois jondubois self-assigned this May 16, 2018
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

No branches or pull requests

2 participants