Skip to content

Commit 2b96332

Browse files
fix(experimental): Add experimental LDScopedClient for incrementally building and propagating contexts (#297)
You can now create a "scoped client", a wrapper of the client that will use the specified context for all operations, including feature flag evaluations and event tracking. This facilitates propagating a context down to all logic that is related to a scoped piece of logic, like a web request. An `LDScopedClient` implements most of the same methods as `LDClient`, but without the `context` argument. A scoped client is mutable, to facilitate incrementally building up a multi-context representing the current scope. You can add new contexts (as long as they aren't replacing an existing kind) with `LDScopedClient.AddContext`, and all contexts added so far will be combined into a multi-context whenever the scoped client is used. `LDScopedClient.OverwriteContextByKind` is offered as an escape hatch if you need to update existing data. --------- Co-authored-by: Matthew M. Keeler <[email protected]>
1 parent 5c8a3ea commit 2b96332

File tree

2 files changed

+1138
-0
lines changed

2 files changed

+1138
-0
lines changed

0 commit comments

Comments
 (0)