Skip to content

Commit 5eeaff6

Browse files
Merge pull request #11 from launchdarkly/lc/update-based-on-spec
Update the Hello Java application based on the new specification
2 parents 37989dd + 5e06426 commit 5eeaff6

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

index.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
body {
2+
margin: 0;
3+
background: #373841;
4+
color: white;
5+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
6+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
7+
sans-serif;
8+
-webkit-font-smoothing: antialiased;
9+
-moz-osx-font-smoothing: grayscale;
10+
text-align: center;
11+
}
12+

index.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1">
66
<title>LaunchDarkly tutorial</title>
77
<script src="https://unpkg.com/launchdarkly-js-client-sdk@3"></script>
8+
<link rel="stylesheet" href="./index.css">
89
</head>
910
<body>
1011
<script>
@@ -14,9 +15,9 @@
1415
const clientSideID = '';
1516

1617
// Set flagKey to the feature flag key you want to evaluate
17-
const flagKey = 'my-boolean-flag';
18+
const flagKey = 'sample-feature';
1819

19-
// Set up the context properties. This context should appear on your
20+
// Set up the evaluation context. This context should appear on your
2021
// LaunchDarkly contexts dashboard soon after you run the demo.
2122
const context = {
2223
kind: 'user',
@@ -37,15 +38,16 @@
3738

3839
function render() {
3940
const flagValue = ldclient.variation(flagKey, false);
40-
const label = 'Feature flag ' + flagKey + ' is ' + flagValue + ' for this context. ';
41+
const label = `The ${flagKey} feature flag evalutes to ${flagValue}.`;
42+
document.body.style.background = flagValue ? '#00844B' : '#373841';
4143
div.replaceChild(document.createTextNode(label), div.firstChild);
4244
}
4345

4446
ldclient.on('initialized', () => {
45-
div.appendChild(document.createTextNode('SDK successfully initialized!'), div.firstChild);
47+
div.replaceChild(document.createTextNode('SDK successfully initialized!'), div.firstChild);
4648
});
4749
ldclient.on('failed', () => {
48-
div.appendChild(document.createTextNode('SDK failed to initialize'), div.firstChild);
50+
div.replaceChild(document.createTextNode('SDK failed to initialize'), div.firstChild);
4951
});
5052
ldclient.on('ready', render);
5153
ldclient.on('change', render);

0 commit comments

Comments
 (0)