From 7b686ed3183142dd4ca7484fdfac9ac8f151e0a7 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Tue, 24 Sep 2024 10:47:14 +0300 Subject: [PATCH] chore: full js sdk example (#8229) --- frontend/src/component/onboarding/sdkSnippets.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/component/onboarding/sdkSnippets.ts b/frontend/src/component/onboarding/sdkSnippets.ts index d19bc41ade..60cfae242f 100644 --- a/frontend/src/component/onboarding/sdkSnippets.ts +++ b/frontend/src/component/onboarding/sdkSnippets.ts @@ -109,12 +109,13 @@ client = UnleashClient( custom_headers={'Authorization': ''}) client.initialize_client()`, - JavaScript: `import { UnleashClient } from 'unleash-proxy-client'; + JavaScript: `const { UnleashClient } = require('unleash-proxy-client'); const unleash = new UnleashClient({ url: '', clientKey: '', appName: 'unleash-onboarding-javascript', + refreshInterval: 5000, }); // Start the background polling @@ -227,7 +228,9 @@ export const checkFlagCodeSnippets: Record = { Python: `while True: print(client.is_enabled("")) asyncio.run(asyncio.sleep(1))`, - JavaScript: ``, + JavaScript: `setInterval(() => { + console.log('Is enabled', unleash.isEnabled('')); +}, 1000);`, React: ``, Vue: ``, Svelte: ``,