1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-10 01:16:39 +02:00

Wrap the client into an event listener in the quickstart doc (#1079)

This commit is contained in:
Nikolay Shebanov 2021-11-11 13:20:19 +01:00 committed by GitHub
parent d22b8503fd
commit e1df5696cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.