Skip to content

Commit 9b00c46

Browse files
chore: update sdk readmes
Signed-off-by: OpenFeature Bot <[email protected]>
1 parent 664a9a6 commit 9b00c46

File tree

11 files changed

+41
-13
lines changed

11 files changed

+41
-13
lines changed

docs/reference/technologies/client/kotlin.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk.
1010
Edits should be made here: https://github.com/open-feature/kotlin-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:29 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon May 13 2024 08:08:22 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/client/swift.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk.
1010
Edits should be made here: https://github.com/open-feature/swift-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:29 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon May 13 2024 08:08:22 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/client/web/index.mdx

+28-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon May 13 2024 08:08:22 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
@@ -118,7 +118,7 @@ To register a provider and ensure it is ready before further actions are taken,
118118

119119
```ts
120120
await OpenFeature.setProviderAndWait(new MyProvider());
121-
```
121+
```
122122

123123
#### Synchronous
124124

@@ -155,9 +155,16 @@ Sometimes, the value of a flag must consider some dynamic criteria about the app
155155
In OpenFeature, we refer to this as [targeting](/specification/glossary#targeting).
156156
If the flag management system you're using supports targeting, you can provide the input data using the [evaluation context](/docs/reference/concepts/evaluation-context).
157157

158+
```ts
159+
// Sets global context during provider registration
160+
await OpenFeature.setProvider(new MyProvider(), { origin: document.location.host });
161+
```
162+
163+
Change context after the provider has been registered using `setContext`.
164+
158165
```ts
159166
// Set a value to the global context
160-
await OpenFeature.setContext({ origin: document.location.host });
167+
await OpenFeature.setContext({ targetingKey: localStorage.getItem("targetingKey") });
161168
```
162169

163170
Context is global and setting it is `async`.
@@ -230,6 +237,24 @@ const domainScopedClient = OpenFeature.getClient("my-domain");
230237
Domains can be defined on a provider during registration.
231238
For more details, please refer to the [providers](#providers) section.
232239

240+
#### Manage evaluation context for domains
241+
242+
By default, domain-scoped clients use the global context.
243+
This can be overridden by explicitly setting context when registering the provider or by references the domain when updating context:
244+
245+
```ts
246+
OpenFeature.setProvider("my-domain", new NewCachedProvider(), { targetingKey: localStorage.getItem("targetingKey") });
247+
```
248+
249+
To change context after the provider has been registered, use `setContext` with a name:
250+
251+
```ts
252+
await OpenFeature.setContext("my-domain", { targetingKey: localStorage.getItem("targetingKey") })
253+
```
254+
255+
Once context has been defined for a named client, it will override the global context for all clients using the associated provider.
256+
Context can be cleared using for a named provider using `OpenFeature.clearContext("my-domain")` or call `OpenFeature.clearContexts()` to reset all context.
257+
233258
### Eventing
234259

235260
Events allow you to react to state changes in the provider or underlying flag management system, such as flag definition changes, provider readiness, or error conditions.

docs/reference/technologies/client/web/react.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon May 13 2024 08:08:22 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/server/dotnet.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from dotnet-sdk.
1010
Edits should be made here: https://github.com/open-feature/dotnet-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon May 13 2024 08:08:21 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
[![Specification](https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge)](https://github.com/open-feature/spec/releases/tag/v0.7.0)

docs/reference/technologies/server/go.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from go-sdk.
99
Edits should be made here: https://github.com/open-feature/go-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Mon May 13 2024 08:08:21 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

docs/reference/technologies/server/java.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk.
99
Edits should be made here: https://github.com/open-feature/java-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Mon May 13 2024 08:08:20 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

docs/reference/technologies/server/javascript/index.mdx

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon May 13 2024 08:08:21 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">
@@ -158,6 +158,9 @@ const requestContext = {
158158
const boolValue = await client.getBooleanValue('some-flag', false, requestContext);
159159
```
160160

161+
Context is merged by the SDK before a flag evaluation occurs.
162+
The merge order is defined [here](/specification/sections/evaluation-context#requirement-323) in the OpenFeature specification.
163+
161164
### Hooks
162165

163166
[Hooks](/docs/reference/concepts/hooks) allow for custom logic to be added at well-defined points of the flag evaluation life-cycle.

docs/reference/technologies/server/javascript/nestjs.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
1010
Edits should be made here: https://github.com/open-feature/js-sdk
1111
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1212

13-
Last updated at Tue May 07 2024 20:53:27 GMT+0000 (Coordinated Universal Time)
13+
Last updated at Mon May 13 2024 08:08:21 GMT+0000 (Coordinated Universal Time)
1414
-->
1515

1616
<p align="center" class="github-badges">

docs/reference/technologies/server/php.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from php-sdk.
99
Edits should be made here: https://github.com/open-feature/php-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Mon May 13 2024 08:08:21 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

docs/reference/technologies/server/python.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This content has been automatically generated from python-sdk.
99
Edits should be made here: https://github.com/open-feature/python-sdk
1010
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs
1111

12-
Last updated at Tue May 07 2024 20:53:28 GMT+0000 (Coordinated Universal Time)
12+
Last updated at Mon May 13 2024 08:08:21 GMT+0000 (Coordinated Universal Time)
1313
-->
1414

1515
<p align="center" class="github-badges">

0 commit comments

Comments
 (0)