1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

chore: full js sdk example (#8229)

This commit is contained in:
Jaanus Sellin 2024-09-24 10:47:14 +03:00 committed by GitHub
parent 7a3a5ad33c
commit 7b686ed318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
@ -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: ``,