From ca6cc159b7c7c6d468661644fe3e5d31a5b85de7 Mon Sep 17 00:00:00 2001 From: kwasniew Date: Thu, 5 Dec 2024 10:48:10 +0100 Subject: [PATCH] chore: streaming example --- examples/streaming.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/streaming.js diff --git a/examples/streaming.js b/examples/streaming.js new file mode 100644 index 00000000..1e7ab25d --- /dev/null +++ b/examples/streaming.js @@ -0,0 +1,14 @@ +const { Unleash } = require('../lib'); + +const client = new Unleash({ + appName: 'my-application', + url: 'https://app.unleash-hosted.com/demo/api/', + customHeaders: { + Authorization: '943ca9171e2c884c545c5d82417a655fb77cec970cc3b78a8ff87f4406b495d0', + }, + experimentalMode: { type: 'streaming' }, + skipInstanceCountWarning: true, +}); +client.on('changed', () => { + console.log(client.isEnabled('demo001', { userId: `${Math.random()}` })); +});