Skip to content

Commit 18625d5

Browse files
authored
Merge pull request #136 from Flagsmith/features/event_source
Features/event source
2 parents 6801aac + 0f99bd6 commit 18625d5

File tree

112 files changed

+47820
-19741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+47820
-19741
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<img width="100%" src="https://raw.githubusercontent.com/Flagsmith/flagsmith/main/static-files/hero.png"/>
2+
3+
# Flagsmith with EventSource
4+
5+
This repository contains basic integration with our realtime eventsource feature from a custom NodeJS server.
6+
7+
**Open index.html** in your browser to run the example.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
7+
<script src="../../../flagsmith/index.js"></script>
8+
<style>
9+
.hidden {
10+
display: none;
11+
}
12+
</style>
13+
</head>
14+
<body>
15+
16+
<div id="loaded" class="hidden">
17+
<h3>Flagsmith Data</h3>
18+
<div id="js-data"></div>
19+
</div>
20+
<div id="loading">
21+
Loading
22+
</div>
23+
<script>
24+
var environmentID = 'AbXqsQqLLAzmfj5SGCm8Ng'
25+
//Intialise Flagsmith
26+
flagsmith.init({
27+
api: "https://edge.bullet-train-staging.win/api/v1/",
28+
environmentID: environmentID,
29+
enableLogs: true,
30+
realtime: true,
31+
onChange: function() {
32+
$("#loaded").removeClass("hidden")
33+
$("#loading").addClass("hidden")
34+
$("#js-data").text(JSON.stringify(flagsmith.getAllFlags(), null, 2));
35+
}
36+
});
37+
</script>
38+
39+
</body>
40+
</html>

0 commit comments

Comments
 (0)