From e1df5696cdfa280c886b9ee7c98f9f42178253ef Mon Sep 17 00:00:00 2001 From: Nikolay Shebanov Date: Thu, 11 Nov 2021 13:20:19 +0100 Subject: [PATCH] Wrap the client into an event listener in the quickstart doc (#1079) --- website/docs/user_guide/quickstart.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/website/docs/user_guide/quickstart.md b/website/docs/user_guide/quickstart.md index eba91e23b1..9fdab31479 100644 --- a/website/docs/user_guide/quickstart.md +++ b/website/docs/user_guide/quickstart.md @@ -46,15 +46,17 @@ const unleash = new UnleashClient({ appName: 'my-webapp', }); +unleash.on('synchronized', () => { + if (unleash.isEnabled('proxy.demo')) { + // do something + } +}); + // Used to set the context fields, shared with the Unleash Proxy unleash.updateContext({ userId: '1233' }); // Start the background polling unleash.start(); - -if (unleash.isEnabled('proxy.demo')) { - // do something -} ``` Now you are ready to use the feature toggle you created in your client side application, using the appropriate proxy SDK.