Skip to content

Commit d89a9d4

Browse files
committed
chore(readme): userId explain & modify options order
1 parent 217ea0f commit d89a9d4

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Or via CDN:
5252

5353
### Step 2. Create a FeatureProbe instance
5454

55-
After you install and import the SDK, create a single, shared instance of the FeatureProbe sdk.
55+
After you install and import the SDK, create a single, shared instance of the FeatureProbe SDK.
5656

5757
NPM:
5858

@@ -61,32 +61,34 @@ const userId = /* unique user id in your business logic */;
6161
const user = new FPUser(userId);
6262
user.with("userId", /* userId */);
6363

64-
let remoteUrl = "https://featureprobe.io/server";
65-
// let remoteUrl = "http://localhost:4007"; // for local docker
64+
const remoteUrl = "https://featureprobe.io/server";
65+
// const remoteUrl = "http://localhost:4007"; // for local docker
6666

6767
const fp = new FeatureProbe({
6868
remoteUrl,
69-
clientSdkKey: /* clientSdkKey */
70-
user,
69+
clientSdkKey: /* clientSdkKey */,
70+
user
7171
});
72+
7273
fp.start();
7374
```
7475

7576
Or via CDN:
7677

7778
```js
78-
const uniqueUserId = /* uniqueUserId */;
79-
const user = new featureProbe.FPUser(uniqueUserId);
79+
const userId = /* unique user id in your business logic */;
80+
const user = new FPUser(userId);
8081
user.with("userId", /* userId */);
8182

82-
let remoteUrl = "https://featureprobe.io/server";
83-
// let remoteUrl = "http://localhost:4007"; // for local docker
83+
const remoteUrl = "https://featureprobe.io/server";
84+
// const remoteUrl = "http://localhost:4007"; // for local docker
8485

8586
const fp = new featureProbe.FeatureProbe({
8687
remoteUrl,
87-
clientSdkKey: /* clientSdkKey */
88-
user,
88+
clientSdkKey: /* clientSdkKey */,
89+
user
8990
});
91+
9092
fp.start();
9193
```
9294

@@ -98,9 +100,9 @@ You can use sdk to check which value this user will receive for a given feature
98100
fp.on("ready", function() {
99101
const result = fp.boolValue(/* toggleKey */, false);
100102
if (result) {
101-
do_some_thing();
103+
// do_some_thing();
102104
} else {
103-
do_other_thing();
105+
// do_other_thing();
104106
}
105107
const reason = fp.boolDetail(/* toggleKey */, false);
106108
console.log(reason);
@@ -144,11 +146,11 @@ This SDK takes the following options:
144146

145147
| option | required | default | description |
146148
|-------------------|----------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------|
149+
| user | yes | n/a | The User with attributes like name, age is used when toggle evaluation |
150+
| clientSdkKey | yes | n/a | The Client SDK Key is used to authentification |
147151
| remoteUrl | depends | n/a | The unified URL to get toggles and post events |
148152
| togglesUrl | no | n/a | The specific URL to get toggles, once set, remoteUrl will be ignored |
149153
| eventsUrl | no | n/a | The specific URL to post events, once set, remoteUrl will be ignored |
150-
| clientSdkKey | yes | n/a | The Client SDK Key is used to authentification |
151-
| user | yes | n/a | The User with attributes like name, age is used when toggle evaluation |
152154
| refreshInterval | no | 1000 | The SDK check for updated in millisecond |
153155

154156
## Testing

0 commit comments

Comments
 (0)