mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-24 01:18:01 +02:00
chore: full js sdk example (#8229)
This commit is contained in:
parent
7a3a5ad33c
commit
7b686ed318
@ -109,12 +109,13 @@ client = UnleashClient(
|
|||||||
custom_headers={'Authorization': '<YOUR_API_TOKEN>'})
|
custom_headers={'Authorization': '<YOUR_API_TOKEN>'})
|
||||||
|
|
||||||
client.initialize_client()`,
|
client.initialize_client()`,
|
||||||
JavaScript: `import { UnleashClient } from 'unleash-proxy-client';
|
JavaScript: `const { UnleashClient } = require('unleash-proxy-client');
|
||||||
|
|
||||||
const unleash = new UnleashClient({
|
const unleash = new UnleashClient({
|
||||||
url: '<YOUR_API_URL>',
|
url: '<YOUR_API_URL>',
|
||||||
clientKey: '<YOUR_API_TOKEN>',
|
clientKey: '<YOUR_API_TOKEN>',
|
||||||
appName: 'unleash-onboarding-javascript',
|
appName: 'unleash-onboarding-javascript',
|
||||||
|
refreshInterval: 5000,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start the background polling
|
// Start the background polling
|
||||||
@ -227,7 +228,9 @@ export const checkFlagCodeSnippets: Record<SdkName, string> = {
|
|||||||
Python: `while True:
|
Python: `while True:
|
||||||
print(client.is_enabled("<YOUR_FLAG>"))
|
print(client.is_enabled("<YOUR_FLAG>"))
|
||||||
asyncio.run(asyncio.sleep(1))`,
|
asyncio.run(asyncio.sleep(1))`,
|
||||||
JavaScript: ``,
|
JavaScript: `setInterval(() => {
|
||||||
|
console.log('Is enabled', unleash.isEnabled('<YOUR_FLAG>'));
|
||||||
|
}, 1000);`,
|
||||||
React: ``,
|
React: ``,
|
||||||
Vue: ``,
|
Vue: ``,
|
||||||
Svelte: ``,
|
Svelte: ``,
|
||||||
|
Loading…
Reference in New Issue
Block a user