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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

questions about the source-code #1417

Open
david-fong opened this issue Dec 6, 2020 · 0 comments
Open

questions about the source-code #1417

david-fong opened this issue Dec 6, 2020 · 0 comments

Comments

@david-fong
Copy link
Contributor

david-fong commented Dec 6, 2020

Background: I'm preparing a PR to add more typing information now that the repo is written in typescript (馃帀). I was wondering if you can explain some things for me.

  • Why does the manager check for whether this.backoff is undefined sometimes? Are there actually times when it is not defined?
  • can the serveClient option for the manager ever be the empty string? If it should never be the empty string, we can use ?? instead of || when defaulting the option.
  • why use component-bind package instead of javascript's native Function.prototype.bind? Isn't it okay to do this.ondata.bind(this) (which is the same as Manager.prototype.ondata.bind(this)) instead of bind(this, "ondata")? One advantage of using native bind is that typescript will check that the types make sense.
  • Would these fields
    image ever need to be used outside of the Socket class? Would it be a good and safe idea to completely prevent code outside of the Socket class from accessing those fields? If so, we could use JavaScript private fields. But... this would be a breaking change, since any dependent packages accessing those fields would no longer be able to use them.
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

1 participant