Closed Aaron040222 closed 4 years ago
Hi!
Hard to tell, but from just looking at the code, the script probably haven't completed loading when you try to use it. Since JavaScript is asynchronous, the code continues to run after you create the script element, it will not stop to wait until the script loads.
You will have to wait until the script loads before using its contents. Generally, it's much easier to just use a ' Githubissues.
I import the l.realtime through this in java script. var script = document.createElement('script'); script.type = "text/javascript"; script.async = true; script.src = 'https://cdnjs.cloudflare.com/ajax/libs/leaflet-realtime/2.0.0/leaflet-realtime.min.js'
And then I change the original geojson function to l.real time like this console.log(geoJson) var geoJsonLayers = L.Realtime(geoJson, { pointToLayer: (feature = {}, latlng) => { const { properties = {} } = feature; let updatedFormatted; let casesString;
} However, it is showing that l.realtime is not a function. I am not sure how to fix it. Sorry it this is a stupid question, but I just start learning coding a few weeks before. Thank you!