Skip to content

A web component simulating the liveboards in the NMBS/SNCB train stations

License

Notifications You must be signed in to change notification settings

jonatcln/belgiantrain-liveboard-wc

Repository files navigation

BelgianTrain Liveboard Web Component

A web component simulating the liveboards in the NMBS/SNCB train stations.

GitHub Release License

This webcomponent follows the open-wc recommendation.

Installation

Install with npm

npm install github:jonatcln/belgiantrain-liveboard-wc#semver:^0.1
<script type="module">
    import 'belgiantrain-liveboard-wc/belgiantrain-liveboard.js';
</script>

Use directly via cdn

<script
    type="module"
    src="https://cdn.jsdelivr.net/gh/jonatcln/[email protected]/dist/belgiantrain-liveboard.min.js"
></script>

Usage

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.

License

Licensed under the MIT license.

About

A web component simulating the liveboards in the NMBS/SNCB train stations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published