Skip to content

Commit 771c2b9

Browse files
Use commonjs for node example in README (#96)
* use commonjs for node example * fix typo * update
1 parent 8fd3ea7 commit 771c2b9

File tree

2 files changed

+8
-8
lines changed
  • src
    • feature-management-applicationinsights-browser
    • feature-management-applicationinsights-node

2 files changed

+8
-8
lines changed

src/feature-management-applicationinsights-browser/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microso
1212
import { createTelemetryPublisher, trackEvent } from "@microsoft/feature-management-applicationinsights-browser";
1313

1414
const appInsights = new ApplicationInsights({ config: {
15-
connectionString: CONNECTION_STRING
15+
connectionString: "<APPINSIGHTS_CONNECTION_STRING>"
1616
}});
1717
appInsights.loadAppInsights();
1818

src/feature-management-applicationinsights-node/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ Feature Management Application Insights Plugin for Node provides a solution for
77
### Prerequisites
88

99
- Node.js LTS version
10+
- `applicationinsights` SDK v2(classic)
1011

1112
### Usage
1213

1314
``` javascript
14-
import appInsights from "applicationinsights";
15-
import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management";
16-
import { createTelemetryPublisher, trackEvent } from "@microsoft/feature-management-applicationinsights-node";
15+
const appInsights = require("applicationinsights");
16+
appInsights.setup(process.env.APPINSIGHTS_CONNECTION_STRING).start();
1717

18-
appInsights.setup(CONNECTION_STRING)
19-
.start();
18+
const { FeatureManager, ConfigurationObjectFeatureFlagProvider } = require("@microsoft/feature-management");
19+
const { createTelemetryPublisher, trackEvent } = require("@microsoft/feature-management-applicationinsights-node");
2020

2121
const publishTelemetry = createTelemetryPublisher(appInsights.defaultClient);
2222
const provider = new ConfigurationObjectFeatureFlagProvider(jsonObject);
2323
const featureManager = new FeatureManager(provider, {onFeatureEvaluated: publishTelemetry});
2424

2525
// FeatureEvaluation event will be emitted when a feature flag is evaluated
26-
featureManager.getVariant("TestFeature", {userId : TARGETING_ID}).then((variant) => { /* do something*/ });
26+
featureManager.getVariant("TestFeature", {userId : "<TARGETING_ID>"}).then((variant) => { /* do something*/ });
2727

2828
// Emit a custom event with targeting id attached.
29-
trackEvent(appInsights.defaultClient, TARGETING_ID, {name: "TestEvent"});
29+
trackEvent(appInsights.defaultClient, "<TARGETING_ID>", {name: "TestEvent"});
3030
```
3131

3232
## Contributing

0 commit comments

Comments
 (0)