Closed martinheidegger closed 5 years ago
Thanks for looking into this!
addExtensions
gets invoked whenever you stat tracking a Hyperdrive or Hypercore so developers are never going to need to invoke it manually.
Ideally they shouldn't need to know it exists. :P
Make it private _addExtensions
?
What's the use case for doing it via that instead of the constructors?
I just read over the code again, and noticed that it was a misunderstanding on my side, namely: I thought addExtensions
is a public method; it is not and that is a totally different issue. Let me open a new issue for that.
I am assuming that "addExtension" should work whenever called from a code perspective, but from an API perspective I believe it could be a problem for developers to understand that calling addExtensions is usually desirable before setting up the hyperdrive.
Maybe there should be an error/warning or API-system that only allows to set it before?
https://github.com/datproject/sdk/blob/9cc14f2a8a150f5753a3ce6709d0151fe701bc81/index.js#L31-L38