You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b43bf7d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/node-sdk/README.md
+6-10Lines changed: 6 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ If the flag is missing or has a different JSON type, such as a string instead of
72
72
73
73
The SDK doesn't check object fields or fill in missing fields from your default.
74
74
75
-
`getFlags(context)` returns an object mapping flag keys to values. Unavailable flags can have an `undefined` value.
75
+
`getFlags(context)` returns an object mapping flag keys to values.
76
76
77
77
Each read records a check, which Reflag uses for launch monitoring.
78
78
@@ -172,21 +172,20 @@ Declarations are checked at compile time only. See the [Reflag CLI](https://docs
172
172
173
173
## Bootstrap the browser
174
174
175
-
**Requires a Browser, React or Vue SDK that supports the v2 bootstrap protocol.** V1 consumers expect a different flag shape and cannot use this result.
176
-
177
-
With a compatible v2 consumer, evaluate flags on the server to render them in the browser without waiting for a network request:
175
+
To render flags in the browser without waiting for a network request, evaluate them on the server and pass the result to the Browser, React or Vue SDK's bootstrap option:
Pass the whole object to the compatible consumer's bootstrap option, serialized with your framework's usual mechanism. Do not pass it to a v1 SDK. Leave secrets and server-only attributes out of the context you bootstrap, because the browser can read it.
181
+
Pass the whole object, serialized with your framework's usual mechanism. Leave secrets and server-only attributes out of the context you bootstrap, because the browser can read it.
184
182
185
183
## Remote evaluation
186
184
187
185
To evaluate flags on Reflag's servers instead of locally, use the remote methods:
188
186
189
187
```ts
188
+
// Root client: key, default, user ID, company ID
190
189
const model =awaitreflag.getFlagRemote("model", "quick", "user-1", "acme");
Unlike `getFlag()`, `getFlagRemote()` on the root client takes the default before the user and company IDs. To read a Boolean, pass `undefined` as the default.
198
+
To read a Boolean with the root client, pass `undefined` as the default.
200
199
201
200
## Edge runtimes
202
201
@@ -239,15 +238,12 @@ Options can be set in the constructor, through environment variables, or in `ref
239
238
|`batchOptions`|| Event batching: `maxSize`, `intervalMs` and `flushOnExit`|
240
239
|`httpClient`|| Custom HTTP client |
241
240
242
-
To disable checks, automatic user/company updates and bound-client usage tracking for a context, pass`enableTracking: false`to reads or `bindClient()`, not to the constructor:
241
+
To stop sending checksand events for a context, include`enableTracking: false`in it:
Explicit calls to the root client's `track()`, `updateUser()` and `updateCompany()` remain separate operations and still send events.
250
-
251
247
## Shutting down
252
248
253
249
Before your process exits, call `await reflag.flush()` to send queued events, then `reflag.destroy()` to stop background work. `batchOptions.flushOnExit` flushes only when Node exits on its own; if you exit on a signal or call `process.exit()`, call `flush()` in your shutdown handler first.
0 commit comments