Skip to content

Commit 9a88e52

Browse files
btthomassameerank
authored andcommitted
docs(browser): fix offline setup example
1 parent fb07bec commit 9a88e52

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

packages/browser/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,19 @@ import { configurationFromString, DatadogProvider, getPrecomputedContext } from
123123
const configuration = configurationFromString(wire)
124124
const context = getPrecomputedContext(configuration)
125125

126-
if (context !== undefined) {
127-
await OpenFeature.setContext(context)
128-
}
129-
130126
const provider = new DatadogProvider({
127+
applicationId: 'app-id',
131128
clientToken: 'pub_...',
132129
site: 'datadoghq.com',
133130
env: 'production',
134131
initialFlagsConfiguration: configuration,
135132
})
136-
await OpenFeature.setProvider(provider)
133+
134+
if (context !== undefined) {
135+
await OpenFeature.setProviderAndWait(provider, context)
136+
} else {
137+
await OpenFeature.setProviderAndWait(provider)
138+
}
137139
```
138140

139141
Applications that only use precomputed configurations can select the smaller,

0 commit comments

Comments
 (0)