launchdarkly / node-server-sdk

LaunchDarkly Server-side SDK for Node
Other
79 stars 65 forks source link

Clarified singleton nature of the LDClient #172

Closed tstone closed 4 years ago

tstone commented 4 years ago

Requirements

I'm marking the tasks here N/A as I only added documentation comments. This PR includes no behavior changes.

Describe the solution you've provided

Typescript engineers who rely primarily on the exported type definitions might miss that the LDClient should only be initialized as a singleton. This PR clarifies that in the inline documentation.

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Missing this detail, a recent implementation initialized the LDClient on each request.

eli-darkly commented 4 years ago

We're going to add a sentence about this, but using more concise text that follows our style and is consistent with the other SDKs. This topic is already covered in the main Getting Started docs.

eli-darkly commented 4 years ago

To expand on that a little: in general our approach to the SDK API docs has been to document the semantics of each SDK type and method, rather than overall usage issue that are common to the LaunchDarkly platform as a whole. We strongly recommend reading the online docs (which are linked from the README file), rather than just picking out one of the SDK repositories on GitHub and diving in using only the in-code docs.

(Also, in this particular case the documentation for init already says "The client will begin attempting to connect to LaunchDarkly as soon as it is created." It would not be feasible to do that for every single request.)