Skip to content

Commit 92b2857

Browse files
Merge pull request #12 from splitio/EmilianoSanchez-patch-1
Update README.md
2 parents ba977bc + 45e9653 commit 92b2857

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,17 @@ import { OpenFeatureSplitProvider } from '@splitsoftware/openfeature-web-split-p
2727

2828
const splitFactory = SplitFactory({
2929
core: {
30-
authorizationKey: 'your auth key'
30+
authorizationKey: 'CLIENT_SIDE_SDK_KEY',
31+
key: 'TARGETING_KEY'
3132
}
3233
});
34+
3335
const provider = new OpenFeatureSplitProvider(splitFactory);
34-
OpenFeature.setProvider(provider);
36+
37+
// Register provider and wait for the default SDK client for 'TARGETING_KEY' to be ready
38+
await OpenFeature.setProviderAndWait(provider);
39+
40+
const client = OpenFeature.getClient();
3541
```
3642

3743
## Use of OpenFeature with Split
@@ -43,7 +49,7 @@ const context: EvaluationContext = {
4349
targetingKey: 'TARGETING_KEY',
4450
trafficType: 'account'
4551
};
46-
OpenFeature.setContext(context)
52+
await OpenFeature.setContext(context)
4753
```
4854

4955
## Evaluate with details
@@ -62,10 +68,11 @@ Evaluation attributes must be set in context before evaluation
6268
const context: EvaluationContext = {
6369
targetingKey: 'TARGETING_KEY',
6470
trafficType: 'account',
71+
// Evaluation attributes:
6572
plan: 'premium',
66-
couppon: 'WELCOME10'
73+
coupon: 'WELCOME10'
6774
};
68-
OpenFeature.setContext(context);
75+
await OpenFeature.setContext(context);
6976
const booleanTreatment = client.getBooleanDetails('boolFlag', false);
7077
```
7178

@@ -89,11 +96,11 @@ Example:
8996
const context = { targetingKey: 'user-123', trafficType: 'account' }
9097
const details = { value: 19.99, properties: { plan: 'pro', coupon: 'WELCOME10' }}
9198

92-
client.setEvaluationContext(context)
99+
await client.setContext(context)
93100
client.track('checkout.completed', details)
94101
```
95102
## Submitting issues
96-
103+
97104
The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/split-openfeature-provider-web-js/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.
98105

99106
## Contributing
@@ -103,13 +110,13 @@ Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to s
103110
Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/).
104111

105112
## About Split
106-
113+
107114
Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery.
108-
115+
109116
To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup.
110-
117+
111118
Split has built and maintains SDKs for:
112-
119+
113120
* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
114121
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
115122
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
@@ -128,10 +135,9 @@ Split has built and maintains SDKs for:
128135
* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
129136
* Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK)
130137
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
131-
138+
132139
For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
133-
140+
134141
**Learn more about Split:**
135-
136-
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information.
137142

143+
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information.

0 commit comments

Comments
 (0)