A web component simulating the liveboards in the NMBS/SNCB train stations.
This webcomponent follows the open-wc recommendation.
npm install github:jonatcln/belgiantrain-liveboard-wc#semver:^0.1
<script type="module">
import 'belgiantrain-liveboard-wc/belgiantrain-liveboard.js';
</script>
<script
type="module"
src="https://cdn.jsdelivr.net/gh/jonatcln/[email protected]/dist/belgiantrain-liveboard.min.js"
></script>
Basic usage example:
<belgiantrain-liveboard id="liveboard" lang="en"></belgiantrain-liveboard>
<script>
fetch(
'http://api.irail.be/liveboard/?station=Gent-Sint-Pieters&format=json&lang=en',
{
method: 'GET',
headers: {
Accept: 'application/json',
},
}
)
.then((response) => response.json())
.then((data) => {
document.getElementById('liveboard').data = data;
});
</script>
Check out demo/index.html
for a complete example.
Licensed under the MIT license.