Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos when updating Marker position #7

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ var sseLyr = L.geoSSE(null, {
Alternatively you can initialize with some existing data when you want to establish the initial state by loading previously created features on connection to event stream.

```js
var sseLyr = L.geoSSE('my-data.geojson', {
var geojson = await fetch('my-data.geojson')
geojson = await geojson.json()

var sseLyr = L.geoSSE(geojson, {
streamUrl: 'https://my-site.com/stream'
// set other layer options...
});
Expand All @@ -78,6 +81,13 @@ When a successful connection is established, by default the layer listens for th

#### Deprecated Event Types

- Add event
> When an `add` event is received from the server, the feature is added or updated.
- Remove event
> When a `remove` event is received from the server, the feature is removed.

#### Deprecated Event Types

- Create event
> When a `create` event is received from the server, the feature is added.
- Update event
Expand Down
2 changes: 1 addition & 1 deletion dist/Leaflet.GeoSSE.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 18 additions & 14 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<!DOCTYPE html>
<html>

<head>
<title>Leaflet-SSE-Test</title>
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
crossorigin=""
/>
<link rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
crossorigin="" />
<!-- Make sure you put this AFTER Leaflet's CSS -->
<script
src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg=="
crossorigin=""
></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg=="
crossorigin=""></script>
<script type="text/javascript" src="/static/Leaflet.GeoSSE.src.js"></script>
</head>
<style>
body {
overflow: hidden;
}

#container {
display: flex;
height: 100vh;
}

#map {
height: 100%;
width: 50vw;
}

#log {
display: flex;
flex-direction: column;
Expand All @@ -40,14 +40,18 @@
padding: 10px;
overflow-y: scroll;
}

#log pre {
text-wrap: wrap;
}
</style>

<body>
<div id="container">
<div id="map"></div>
<div id="log"><pre>Listening for events...</pre></div>
<div id="log">
<pre>Listening for events...</pre>
</div>
</div>
<script>
const mymap = L.map("map").setView([38.9072, -77.0369], 13);
Expand All @@ -74,8 +78,7 @@
const now = new Date();
const entry = document.createElement("pre");
const text = document.createTextNode(
`${eventType} (${now.toLocaleDateString()} ${now.toLocaleTimeString()}): ${
event.data
`${eventType} (${now.toLocaleDateString()} ${now.toLocaleTimeString()}): ${event.data
}`
);
entry.appendChild(text);
Expand All @@ -86,4 +89,5 @@
}
</script>
</body>

</html>
Loading