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
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 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.
The text was updated successfully, but these errors were encountered:
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.
this.backoff
is undefined sometimes? Are there actually times when it is not defined?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.Function.prototype.bind
? Isn't it okay to dothis.ondata.bind(this)
(which is the same asManager.prototype.ondata.bind(this)
) instead ofbind(this, "ondata")
? One advantage of using native bind is that typescript will check that the types make sense.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.
The text was updated successfully, but these errors were encountered: