Skip to content

ref(flags): update unleashIntegration param #12795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 26, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion platform-includes/configuration/unleash/javascript.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
Before using this integration, you need to install and instrument Unleash in your app. Learn more by reading [Unleash's SDK reference](https://docs.getunleash.io/reference/sdks/javascript-browser) and [quickstart](https://docs.getunleash.io/quickstart).

```javascript
```javascript {tabTitle: JavaScript}
import * as Sentry from '@sentry/browser';
import { UnleashClient } from 'unleash-proxy-client';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [Sentry.unleashIntegration({featureFlagClientClass: UnleashClient})],
});

const unleash = new UnleashClient({
url: 'https://<your-unleash-instance>/api/frontend',
clientKey: '<your-client-side-token>',
appName: 'my-webapp',
});

unleash.start();

// Evaluate a flag with a default value. You may have to wait for your client to synchronize first.
unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```

```javascript {tabTitle: JavaScript (deprecated)}
import * as Sentry from '@sentry/browser';
import { UnleashClient } from 'unleash-proxy-client';

Expand All @@ -22,3 +45,11 @@ unleash.isEnabled('test-flag');

Sentry.captureException(new Error('Something went wrong!'));
```

<Alert level="info">

The `featureFlagClientClass` option is supported starting from v8.TODO:<br/>
The deprecated `unleashClientClass` option is no longer supported starting from v9.0.1.<br/>
The use of these options should be mutually exclusive.

</Alert>