Skip to content

Commit 193c625

Browse files
committed
More changes to js example
1 parent 570485f commit 193c625

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
cd ../..
4545
cd samples/javascript
4646
sudo npm link ../../targets/api-client-javascript
47-
node index.js
47+
node --experimental-modules index.js
4848
4949
5050
test-python:

samples/javascript/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
var LaunchDarklyApi = require('launchdarkly-api');
2-
var defaultClient = LaunchDarklyApi.ApiClient.instance;
1+
import LaunchDarklyApi from 'launchdarkly-api';
32

4-
var Token = defaultClient.authentications['ApiKey'];
3+
const defaultClient = LaunchDarklyApi.ApiClient.instance;
4+
5+
const Token = defaultClient.authentications['ApiKey'];
56
Token.apiKey = process.env.LD_API_KEY;
67

7-
var apiInstance = new LaunchDarklyApi.FeatureFlagsApi();
8+
const apiInstance = new LaunchDarklyApi.FeatureFlagsApi();
89

910
const projectName = "openapi";
1011
const keyName = "test-javascript";
1112

12-
var callback = function(error, data) {
13+
const callback = (error, data) => {
1314
if (error) {
1415
console.error(error);
1516
process.exit(1);
@@ -18,7 +19,7 @@ var callback = function(error, data) {
1819
}
1920
};
2021

21-
var postCallback = function(error, data) {
22+
const postCallback = (error, data) => {
2223
callback(error, data);
2324

2425
if (!error) {
@@ -32,4 +33,4 @@ apiInstance.postFeatureFlag(projectName,
3233
name: "Test Flag Javascript",
3334
key: keyName,
3435
variations: [{value: [1, 2]}, {value: [3, 4]}, {value: [5]}]
35-
}, {}, postCallback);
36+
}, {}, postCallback);

samples/javascript/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}

0 commit comments

Comments
 (0)