Skip to content

Commit

Permalink
Updated readme (#662)
Browse files Browse the repository at this point in the history
* Updated readme

* Update README.md

Co-authored-by: Melinda Fekete <[email protected]>

* Update README.md

Co-authored-by: Melinda Fekete <[email protected]>

* Update README.md

Co-authored-by: Melinda Fekete <[email protected]>

* Update README.md

Co-authored-by: Melinda Fekete <[email protected]>

---------

Co-authored-by: Melinda Fekete <[email protected]>
  • Loading branch information
alvinometric and melindafekete authored Sep 24, 2024
1 parent 929f148 commit 2f906a4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The official Unleash client SDK for Node.js.

## Getting started

### 1. Install the unleash-client into your project
### 1. Install the Unleash client in your project

```bash
npm install unleash-client
Expand All @@ -24,7 +24,7 @@ yarn add unleash-client

(Or any other tool you like.)

### 2. Initialize unleash-client
### 2. Initialize `unleash-client`

Once installed, you must initialize the SDK in your application. By default, Unleash initialization
is asynchronous, but if you need it to be synchronous, you can
Expand Down Expand Up @@ -146,6 +146,20 @@ the event that all your app does is to start the SDK and check a feature status,
node app running until the SDK has synchronized with the Unleash API. It is **not** required in
normal apps.

#### Check variants

You can use the `getVariant` method to retrieve the variant of a feature flag. If the flag is disabled or
doesn't have any variants, the method returns the
[disabled variant](https://docs.getunleash.io/reference/feature-toggle-variants#the-disabled-variant).

```js
const variant = unleash.getVariant('demo-variant');

if (variant.name === 'blue') {
// do something with the blue variant...
}
```

#### Providing an Unleash context

Calling the `isEnabled` method with just a feature name will work in simple use cases, but in many
Expand Down

0 comments on commit 2f906a4

Please sign in to comment.