From fbec6010d8b053b9a76db33eebe9b540f0d738e4 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Wed, 10 Jan 2024 12:41:43 +0100 Subject: [PATCH 1/6] Fix broken code samples --- website/docs/advanced/targeting.md | 2 +- website/docs/getting-started.md | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/website/docs/advanced/targeting.md b/website/docs/advanced/targeting.md index a53d5ed3..32ca5887 100644 --- a/website/docs/advanced/targeting.md +++ b/website/docs/advanced/targeting.md @@ -92,7 +92,7 @@ const userObject = { email: userEmail, custom: { domain: userDomain }, }; -const value = configCatClient.getValue(key, defaultValue, callback, userObject); +const value = await configCatClient.getValueAsync(key, defaultValue, userObject); ``` Support for confidential comparators was introduced in these SDK versions: diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index e7c89797..1df561f5 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -33,14 +33,14 @@ See the detailed [Docs on how to use the ConfigCat SDKs.](/sdk-reference/overvie Here's a short example to demonstrate the concept: ```js -var configcat = require('configcat-client'); -var client = configcat.createClient('YOUR SDK KEY HERE'); - -client.getValue('isMyFeatureEnabled', false, (value) => { - if (value === true) { - do_the_new_thing(); - } else { - do_the_old_thing(); - } -}); +const configcat = await import("https://cdn.jsdelivr.net/npm/configcat-js/+esm"); +const client = configcat.getClient('YOUR SDK KEY HERE'); + +const value = await client.getValueAsync('isMyFeatureEnabled', false); + +if (value) { + do_the_new_thing(); +} else { + do_the_old_thing(); +} ``` From 4da80e3d2a3fb661e63057b5eab9cf4c3bc6e522 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Wed, 10 Jan 2024 15:38:31 +0100 Subject: [PATCH 2/6] Update supported platform list --- website/docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index 1df561f5..4a7f6779 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -24,7 +24,7 @@ then you can **connect your application** to the ConfigCat service to access you ### Connect your application -There are ready to use code snippets for `.NET`, `Java`, `Android (Java)`, `Kotlin`, `iOS`, `Dart (Flutter)`, `Node`, `JavaScript`, `Python`, `Go`, `PHP`, `Elixir`, `C++` on the ConfigCat Dashboard, just scroll down to the **SDK Key and steps to connect your application** section. +There are ready to use code snippets for `.NET`, `Java`, `Android (Java)`, `Kotlin`, `iOS (Swift)`, `Dart (Flutter)`, `Node`, `JavaScript`, `React`, `Python`, `Go`, `PHP`, `Ruby`, `Elixir`, `C++` on the ConfigCat Dashboard, just scroll down to the **SDK Key and steps to connect your application** section. All the ConfigCat SDKs are open-source and available on GitHub. From 79a569a5b776eac0cc0a77614d00d04e5f844e56 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Wed, 10 Jan 2024 16:02:49 +0100 Subject: [PATCH 3/6] Improve getting started example --- website/docs/getting-started.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index 4a7f6779..d150a906 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -33,11 +33,20 @@ See the detailed [Docs on how to use the ConfigCat SDKs.](/sdk-reference/overvie Here's a short example to demonstrate the concept: ```js -const configcat = await import("https://cdn.jsdelivr.net/npm/configcat-js/+esm"); +// 0. Install the ConfigCat SDK package for the platform you use. +// E.g. `npm install configcat-js` + +// 1. Import the ConfigCat SDK package. +import * as configcat from 'configcat-js'; +// (Or use `const configcat = import("https://esm.sh/configcat-js");` instead if you just want to do a quick test in a scratchpad.) + +// 2. Get a client object for the SDK Key of your config. const client = configcat.getClient('YOUR SDK KEY HERE'); +// 3. Evaluate a feature flag using the client object. const value = await client.getValueAsync('isMyFeatureEnabled', false); +// 4. Based on the value of the feature flag decide whether or not to enable the related feature. if (value) { do_the_new_thing(); } else { From c12299aae55da3c394a12edd29ee7a38a79152f6 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Wed, 10 Jan 2024 16:09:54 +0100 Subject: [PATCH 4/6] Break long comment line --- website/docs/getting-started.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index d150a906..b0a2e46b 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -38,7 +38,8 @@ Here's a short example to demonstrate the concept: // 1. Import the ConfigCat SDK package. import * as configcat from 'configcat-js'; -// (Or use `const configcat = import("https://esm.sh/configcat-js");` instead if you just want to do a quick test in a scratchpad.) +// (Or use `const configcat = import("https://esm.sh/configcat-js");` instead +// if you just want to do a quick test in a scratchpad.) // 2. Get a client object for the SDK Key of your config. const client = configcat.getClient('YOUR SDK KEY HERE'); From 0ab79d8d40a54672cfbd7dfa6d87acea812a5b55 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Wed, 10 Jan 2024 16:14:18 +0100 Subject: [PATCH 5/6] Improve wording --- website/docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index b0a2e46b..d7249e64 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -33,7 +33,7 @@ See the detailed [Docs on how to use the ConfigCat SDKs.](/sdk-reference/overvie Here's a short example to demonstrate the concept: ```js -// 0. Install the ConfigCat SDK package for the platform you use. +// 0. If necessary, install the ConfigCat SDK package for the platform you use. // E.g. `npm install configcat-js` // 1. Import the ConfigCat SDK package. From 712dd514f769f81ff33411ac2e9dbae4013ca053 Mon Sep 17 00:00:00 2001 From: Adam Simon Date: Wed, 10 Jan 2024 17:56:46 +0100 Subject: [PATCH 6/6] Remove tip on quick testing sample code --- website/docs/getting-started.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index d7249e64..77df3356 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -38,8 +38,6 @@ Here's a short example to demonstrate the concept: // 1. Import the ConfigCat SDK package. import * as configcat from 'configcat-js'; -// (Or use `const configcat = import("https://esm.sh/configcat-js");` instead -// if you just want to do a quick test in a scratchpad.) // 2. Get a client object for the SDK Key of your config. const client = configcat.getClient('YOUR SDK KEY HERE');