Skip to content

Commit 0751594

Browse files
Merge pull request #9 from drone/FFM-1422
[FFM-1422] Singleton implementation
2 parents fc6f224 + 17915f3 commit 0751594

13 files changed

+625
-244
lines changed

example/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { CfClient } from 'ff-nodejs-server-sdk';
1+
const pkg = require('ff-nodejs-server-sdk');
2+
const { Client } = pkg;
23

3-
const client = new CfClient('1c100d25-4c3f-487b-b198-3b3d01df5794');
4+
const client = new Client('1c100d25-4c3f-487b-b198-3b3d01df5794');
45

56
setInterval(() => {
67
const value = client.boolVariation('test', null, false);

example/index.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Client } from 'ff-nodejs-server-sdk';
2+
3+
const client = new Client('1c100d25-4c3f-487b-b198-3b3d01df5794');
4+
5+
setInterval(() => {
6+
const value = client.boolVariation('test', null, false);
7+
console.log("Evaluation for flag test and target none: ", value);
8+
}, 10000);

example/index_cf.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import CfClient from 'ff-nodejs-server-sdk';
2+
3+
CfClient.init('1c100d25-4c3f-487b-b198-3b3d01df5794');
4+
5+
setInterval(() => {
6+
const value = CfClient.boolVariation('test', null, false);
7+
console.log("Evaluation for flag test and target none: ", value);
8+
}, 10000);

example/package-lock.json

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "1.0.0",
44
"description": "NodeJS Server SDK sample",
55
"main": "index.js",
6-
"type": "module",
76
"scripts": {
7+
"cf": "node index_cf.mjs",
8+
"client": "node index.mjs",
89
"start": "node index.js",
910
"test": "echo \"Error: no test specified\" && exit 1"
1011
},

0 commit comments

Comments
 (0)