How to use the unleash-client.Strategy function in unleash-client

To help you get started, we’ve selected a few unleash-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Unleash / unleash / packages / unleash-demo-app / alot-of-clients.js View on Github external
.forEach((v, index) => {
        const instance = new unleash.Unleash({
            appName: `demo-app-${index % 5}`,
            instanceId: `index-${index}`,
            url: 'http://localhost:4242/',
            refreshIntervall: 4000,
            metricsInterval: 10000,
            strategies: [
                new unleash.Strategy('extra', true),
            ],
        });


        instance.on('ready', () => {
            console.log('connected to unleash', index);

            setInterval(() => {
                instance.isEnabled('toggle-1', null, Boolean(Math.round(Math.random() * 2)));
            }, Math.round(Math.random() * 1000));
            setInterval(() => {
                instance.isEnabled('toggle-2', null, Boolean(Math.round(Math.random() * 2)));
            }, 1500);
            setInterval(() => {
                instance.isEnabled('toggle-3', null, Boolean(Math.round(Math.random() * 2)));
            }, 1300);

unleash-client

Unleash Client for Node

Apache-2.0
Latest version published 14 days ago

Package Health Score

86 / 100
Full package analysis