Skip to content

Commit

Permalink
chore: full js sdk example (#8229)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus authored Sep 24, 2024
1 parent 7a3a5ad commit 7b686ed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/component/onboarding/sdkSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ client = UnleashClient(
custom_headers={'Authorization': '<YOUR_API_TOKEN>'})
client.initialize_client()`,
JavaScript: `import { UnleashClient } from 'unleash-proxy-client';
JavaScript: `const { UnleashClient } = require('unleash-proxy-client');
const unleash = new UnleashClient({
url: '<YOUR_API_URL>',
clientKey: '<YOUR_API_TOKEN>',
appName: 'unleash-onboarding-javascript',
refreshInterval: 5000,
});
// Start the background polling
Expand Down Expand Up @@ -227,7 +228,9 @@ export const checkFlagCodeSnippets: Record<SdkName, string> = {
Python: `while True:
print(client.is_enabled("<YOUR_FLAG>"))
asyncio.run(asyncio.sleep(1))`,
JavaScript: ``,
JavaScript: `setInterval(() => {
console.log('Is enabled', unleash.isEnabled('<YOUR_FLAG>'));
}, 1000);`,
React: ``,
Vue: ``,
Svelte: ``,
Expand Down

0 comments on commit 7b686ed

Please sign in to comment.